Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/刀具产品调取Cloud刀具标准库(10.11)

# Conflicts:
#	sf_base/models/tool_base.py
#	sf_base/models/tool_base_new.py
#	sf_maintenance/views/maintenance_views.xml
#	sf_mrs_connect/models/res_config_setting.py
This commit is contained in:
jinling.yang
2023-10-19 10:53:03 +08:00
13 changed files with 1040 additions and 351 deletions

View File

@@ -10,7 +10,7 @@
""", """,
'category': 'sf', 'category': 'sf',
'website': 'https://www.sf.jikimo.com', 'website': 'https://www.sf.jikimo.com',
'depends': [], 'depends': ['web'],
'data': [ 'data': [
], ],
@@ -23,6 +23,10 @@
'web.assets_backend': [ 'web.assets_backend': [
'jikimo_frontend/static/src/fields/custom_many2many_checkboxes/*', 'jikimo_frontend/static/src/fields/custom_many2many_checkboxes/*',
'jikimo_frontend/static/src/scss/custom_style.scss', 'jikimo_frontend/static/src/scss/custom_style.scss',
# 'jikimo_frontend/static/src/views/list_nums/list_nbCols.js',
'jikimo_frontend/static/src/views/list_nums/list_nums.xml',
'jikimo_frontend/static/src/views/list_nums/list_nums2.xml',
'jikimo_frontend/static/src/views/list_nums/list_nums3.xml',
], ],
}, },

View File

@@ -304,4 +304,40 @@ div[class="o_content o_component_with_search_panel"] .o_kanban_primary_right > .
.test_model>div .o_field_widget { .test_model>div .o_field_widget {
width: 40% !important; width: 40% !important;
} }
.o_form_label {
font-weight: 700 !important;
}
.bigger .o_horizontal_separator {
font-size: 1.5rem;
}
.o_horizontal_separator {
font-size: 1.5rem;
}
.o_field_widget input[class='o_input'] {
text-align: center
}
div:has(.o_required_modifier) > label::before {
position: absolute;
left: -3px;
}
.o_form_view .o_form_label {
position: relative;
width: 9rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding-left: 1rem;
}
.o_form_view .o_form_label:hover {
white-space: normal;
overflow: visible;
}

View File

@@ -0,0 +1,11 @@
/** @odoo-module **/
import { patch } from "@web/core/utils/patch";
import { ListRenderer } from "@web/views/list/list_renderer";
patch(ListRenderer.prototype, '/jikimo_frontend/static/src/views/list_nums/list_nbCols.js', {
get nbCols() {
const nbCols = this._super(...arguments);
return nbCols + 1;
}
});

View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- <odoo> -->
<!-- <data> -->
<!-- <templates xml:space="preserve"> -->
<t t-name="og.web.ListRenderer" t-inherit="web.ListRenderer" t-inherit-mode="extension">
<xpath expr="//table/thead/tr/th[@t-if='hasSelectors']" position="before">
<th><i class="fa fa-list-ol"/></th>
</xpath>
</t>
<!-- 暂存,同一份文件中有问题,拆分后正常工作 -->
<!-- <t t-name="og.web.ListRenderer.Rows" t-inherit="web.ListRenderer.Rows" t-inherit-mode="extension"> -->
<!-- <xpath expr="//t[@t-key='record.id']/t[last()]" position="inside"> -->
<!-- <t t-set="recordSeq" t-value="record_index + 1"/> -->
<!-- <t t-set="recordOffset" t-value="list.offset"/> -->
<!-- </xpath> -->
<!-- </t> -->
<!-- <t t-name="og.web.ListRenderer.RecordRow" t-inherit="web.ListRenderer.RecordRow" t-inherit-mode="extension"> -->
<!-- <xpath expr="//tr/td[1]" position="before"> -->
<!-- <td> -->
<!-- <t t-esc="222"/> -->
<!-- </td> -->
<!-- </xpath> -->
<!-- </t> -->
<!-- <t t-set="recordlimit" t-value="list.limit"/> -->
<!-- <t t-set="recordpage" t-value="list.page"/> -->
<!-- <t t-set="recordpages" t-value="list.pages"/> -->
<!-- <t t-set="recordcount" t-value="list.count"/> -->
<!-- <t t-set="recordids" t-value="list.ids"/> -->
<!-- <t t-set="recordid" t-value="record.id"/> -->
<!-- <t t-set="recordindex" t-value="record.index"/> -->
<!-- <t t-set="recorddata" t-value="record.data"/> -->
<!-- <t t-set="recordstate" t-value="record.state"/> -->
<!-- <t t-set="recordres_id" t-value="record.res_id"/> -->
<!-- <t t-set="recordcontext" t-value="record.context"/> -->
<!-- <t t-set="recordmodel" t-value="record.model"/> -->
<!-- <t t-set="recordfields" t-value="record.fields"/> -->
<!-- <t t-set="recordfields_view" t-value="record.fields_view"/> -->
<!-- <t t-set="recordfields_keys" t-value="record.fields_keys"/> -->
<!-- <t t-set="recordfields_get" t-value="record.fields_get"/> -->
<!-- <t t-set="recordfields_raw" t-value="record.fields_raw"/> -->
<!-- <t t-set="recordfields_view_get" t-value="record.fields_view_get"/> -->
<!-- <t t-set="recordfields_view_raw" t-value="record.fields_view_raw"/> -->
<!-- <t t-set="recordfields_view_fields" t-value="record.fields_view_fields"/> -->
<!-- <t t-set="recordfields_view_arch" t-value="record.fields_view_arch"/> -->
<!-- <t t-set="recordfields_view_type" t-value="record.fields_view_type"/> -->
<!-- <t t-set="recordfields_view_inherit" t-value="record.fields_view_inherit"/> -->
<!-- <t t-set="recordfields_view_parent" t-value="record.fields_view_parent"/> -->
<!-- <t t-set="recordfields_view_id" t-value="record.fields_view_id"/> -->
<!-- <t t-set="recordfields_view_name" t-value="record.fields_view_name"/> -->
<!-- <t t-set="recordfields_view_mode" t-value="record.fields_view_mode"/> -->
<!-- <t t-set="recordfields_view_type" t-value="record.fields_view_type"/> -->
<!-- <t t-set="recordfields_view_arch" t-value="record.fields_view_arch"/> -->
<!-- <t t-set="recordfields_view_inherit" t-value="record.fields_view_inherit"/> -->
<!-- <t t-set="recordfields_view_parent" t-value="record.fields_view_parent"/> -->
<!-- <t t-set="recordfields_view_id" t-value="record.fields_view_id"/> -->
<!-- </templates> -->
<!-- <templates xml:space="preserve"> -->
<!-- </templates> -->
<!-- </data> -->
<!-- </odoo> -->

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<t t-name="og.web.ListRenderer.Rows" t-inherit="web.ListRenderer.Rows" t-inherit-mode="extension">
<xpath expr="//t[@t-key='record.id']/t[last()]" position="inside">
<t t-set="recordSeq" t-value="record_index + 1"/>
<t t-set="recordOffset" t-value="list.offset"/>
</xpath>
</t>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<t t-name="og.web.ListRenderer.RecordRow" t-inherit="web.ListRenderer.RecordRow" t-inherit-mode="extension">
<xpath expr="//tr/td[1]" position="before">
<td>
<t t-esc="recordOffset + recordSeq"/>
</td>
</xpath>
</t>

View File

@@ -30,7 +30,7 @@ class FixtureModel(models.Model):
fixture_material_id = fields.Many2one('sf.fixture.material', string="夹具物料", ) fixture_material_id = fields.Many2one('sf.fixture.material', string="夹具物料", )
fixture_material_type = fields.Char(string="夹具物料类型", related='fixture_material_id.name', store=True) fixture_material_type = fields.Char(string="夹具物料类型", related='fixture_material_id.name', store=True)
multi_mounting_type_id = fields.Many2one('sf.multi_mounting.type', string="联装类型") multi_mounting_type_id = fields.Many2one('sf.multi_mounting.type', string="联装类型")
brand_id = fields.Many2one('sf.machine.brand', string="品牌") brand_id = fields.Many2one('sf.machine.brand', string="品牌", domain="[('tag_ids.name', 'ilike', '夹具')]")
clamping_way = fields.Char(string="装夹方式") clamping_way = fields.Char(string="装夹方式")
port_type = fields.Char(string="接口类型") port_type = fields.Char(string="接口类型")
model_file = fields.Binary(string="3D模型图") model_file = fields.Binary(string="3D模型图")

304
sf_base/models/tool_base.py Normal file
View File

@@ -0,0 +1,304 @@
# -*- coding: utf-8 -*-
import logging
from odoo import fields, models, api
# from odoo.exceptions import UserError
# # from odoo.addons import sf_base, sf_common
# from datetime import datetime
# 功能刀具物料
class CuttingToolMaterial(models.Model):
_name = 'sf.cutting.tool.material'
_description = '刀具物料'
code = fields.Char('编码')
name = fields.Char('名称')
remark = fields.Char('备注')
active = fields.Boolean('有效', default=True)
# 功能刀具
class FunctionalCuttingTool(models.Model):
_name = 'sf.functional.cutting.tool'
_description = '功能刀具'
code = fields.Char('编码')
name = fields.Char('名称')
functional_model_number = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型')
integral_model_number = fields.Many2one('sf.integral.cutting.tool', string='整体式刀具型号')
blade_model_number = fields.Many2one('sf.blade', string='刀片型号')
cutterbar_model_number = fields.Many2one('sf.cutter.bar', string='刀杆型号')
cutterpad_model_number = fields.Many2one('sf.cutter.pad', string='刀盘型号')
handle_model_number = fields.Many2one('sf.handle', string='刀柄型号')
chuck_model_number = fields.Many2one('sf.chuck', string='夹头型号')
diameter = fields.Float('直径(mm)')
tool_grade = fields.Selection([('1', 'P1'), ('2', 'P2'), ('3', 'P3'), ('4', 'P4'), ('5', 'P5'), ('6', 'P6')],
string='刀具等级')
machining_accuracy = fields.Float('加工精度(mm)')
tool_length = fields.Float('装刀长')
blade_number = fields.Integer('刃数')
integral_blade_length = fields.Float('整体刃长(mm)')
effective_blade_length = fields.Float('有效刃长(mm)')
max_life = fields.Float('最大寿命值')
is_standard = fields.Boolean('是否标准刀')
applicable_range = fields.Char('适用范围')
image = fields.Binary('图片')
active = fields.Boolean('有效', default=True)
# 功能刀具类型
class FunctionalCuttingToolModel(models.Model):
_name = 'sf.functional.cutting.tool.model'
_description = '功能刀具类型'
name = fields.Char('名称')
code = fields.Char('编码')
remark = fields.Char('备注')
active = fields.Boolean('有效', default=True)
# 整体式刀具
class IntegralCuttingTool(models.Model):
_name = 'sf.integral.cutting.tool'
_description = '整体式刀具'
code = fields.Char('编码')
name = fields.Char('型号名称')
# 关联刀具物料
cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料')
# 整体式刀具类型字段,关联整体式刀具类型对象
integral_model_number = fields.Many2one('sf.integral.cutting.tool.model', '整体式刀具类型')
# 增加品牌、总长度(mm)、柄部长度(mm)、刃部长度(mm)、直径(mm)、刃数、前角(°)、后角(°)、主偏角(°)、材料型号、配对螺母(mm)、适用夹头型号、适用范围、图片、创建人、创建时间等字段
brand = fields.Many2one('sf.machine.brand', '品牌', domain="[('tag_ids.name', 'ilike', '刀具')]")
total_length = fields.Float('总长度(mm)')
shank_length = fields.Float('柄部长度(mm)')
blade_length = fields.Float('刃部长度(mm)')
diameter = fields.Float('直径(mm)')
blade_number = fields.Integer('刃数')
front_angle = fields.Float('前角(°)')
rear_angle = fields.Float('后角(°)')
main_included_angle = fields.Float('主偏角(°)')
material_model = fields.Many2one('sf.materials.model', '材料型号')
nut = fields.Float('配对螺母(mm)')
# 适用夹头型号可以多选
chuck_model = fields.Many2many('sf.chuck', string='适用夹头型号')
scope = fields.Char('适用范围')
image = fields.Binary('图片')
active = fields.Boolean('有效', default=True)
# 整体式刀具类型
class IntegralCuttingToolModel(models.Model):
_name = 'sf.integral.cutting.tool.model'
_description = '整体式刀具类型'
code = fields.Char('编码')
name = fields.Char('名称')
# 关联刀具物料
cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料')
remark = fields.Char('备注')
# 刀片
class Blade(models.Model):
_name = 'sf.blade'
_description = '刀片'
code = fields.Char('编码')
name = fields.Char('型号名称')
# 关联刀具物料
cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料')
# 刀片类型字段,关联刀片类型对象
blade_model_number = fields.Many2one('sf.blade.model', '刀片类型')
# 编码、型号名称、刀片类型、品牌、长度L(mm)、宽度D(mm)、高度T(mm)、顶角(°)、前角(°)、后角(°)、主偏角(°)、R角(°)、材料型号、加工硬度、配对螺母(mm)、适用刀杆/刀盘型号、刀尖半径(mm)、图片、创建人、创建时间字段
brand = fields.Many2one('sf.machine.brand', '品牌', )
length = fields.Float('长度L(mm)')
width = fields.Float('宽度D(mm)')
height = fields.Float('高度T(mm)')
top_angle = fields.Float('顶角(°)')
front_angle = fields.Float('前角(°)')
rear_angle = fields.Float('后角(°)')
main_included_angle = fields.Float('主偏角(°)')
r_angle = fields.Float('R角(°)')
material_model = fields.Many2one('sf.materials.model', '材料型号')
hardness = fields.Char('加工硬度')
nut = fields.Float('配对螺母(mm)')
# 适用刀杆型号可以多选
cutter_bar = fields.Many2many('sf.cutter.bar', string='适用刀杆型号')
# 适用刀盘型号可以多选
cutter_pad = fields.Many2many('sf.cutter.pad', string='适用刀盘型号')
radius = fields.Float('刀尖半径(mm)')
image = fields.Binary('图片')
# 刀片类型
class BladeModel(models.Model):
_name = 'sf.blade.model'
_description = '刀片类型'
code = fields.Char('编码')
name = fields.Char('名称')
# 关联刀具物料
cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料')
# 刀片类型字段,关联刀片对象
blade_ids = fields.One2many('sf.blade', 'blade_model_number', '刀片类型')
remark = fields.Char('备注')
# 刀杆
class CutterBar(models.Model):
_name = 'sf.cutter.bar'
_description = '刀杆'
code = fields.Char('编码')
name = fields.Char('型号名称')
# 关联刀具物料
cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料')
# 刀杆类型字段,关联刀杆类型对象
cutter_bar_model_number = fields.Many2one('sf.cutter.bar.model', '刀杆类型')
# 品牌、C柄径(mm)、L总长(mm)、材料型号、刃数、D刃径(mm)、适用刀片型号、配对扳手(mm)、配备螺丝(mm)、刀尖圆角半径、精度等级、硬度(°)、适用范围、图片、创建人、创建时间
brand = fields.Many2one('sf.machine.brand', '品牌')
c_diameter = fields.Float('C柄径(mm)')
total_length = fields.Float('L总长(mm)')
material_model = fields.Many2one('sf.materials.model', '材料型号')
blade_number = fields.Integer('刃数')
d_diameter = fields.Float('D刃径(mm)')
blade = fields.Many2many('sf.blade', string='适用刀片型号')
wrench = fields.Float('配对扳手(mm)')
screw = fields.Float('配备螺丝(mm)')
radius = fields.Float('刀尖圆角半径')
accuracy = fields.Char('精度等级')
hardness = fields.Char('硬度(°)')
scope = fields.Char('适用范围')
image = fields.Binary('图片')
# 刀杆类型
class CutterBarModel(models.Model):
_name = 'sf.cutter.bar.model'
_description = '刀杆类型'
code = fields.Char('编码')
name = fields.Char('名称')
# 关联刀具物料
cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料')
remark = fields.Char('备注')
# 刀盘
class CutterPad(models.Model):
_name = 'sf.cutter.pad'
_description = '刀盘'
code = fields.Char('编码')
name = fields.Char('型号名称')
# 关联刀具物料
cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料')
# 刀盘类型字段,关联刀盘类型对象
cutter_pad_model_number = fields.Many2one('sf.cutter.pad.model', '刀盘类型')
# 增加品牌、C柄径(mm)、L总长(mm)、材料型号、刃数、D刃径(mm)、适用刀片型号、配对扳手(mm)、配备螺丝(mm)、刀尖圆角半径、精度等级、硬度(°)、适用范围、图片、创建人、创建时间
brand = fields.Many2one('sf.machine.brand', '品牌')
c_diameter = fields.Float('C柄径(mm)')
total_length = fields.Float('L总长(mm)')
material_model = fields.Many2one('sf.materials.model', '材料型号')
blade_number = fields.Integer('刃数')
d_diameter = fields.Float('D刃径(mm)')
blade = fields.Many2many('sf.blade', string='适用刀片型号')
wrench = fields.Float('配对扳手(mm)')
screw = fields.Float('配备螺丝(mm)')
radius = fields.Float('刀尖圆角半径')
accuracy = fields.Char('精度等级')
hardness = fields.Char('硬度(°)')
scope = fields.Char('适用范围')
image = fields.Binary('图片')
# 刀盘类型
class CutterPadModel(models.Model):
_name = 'sf.cutter.pad.model'
_description = '刀盘类型'
code = fields.Char('编码')
name = fields.Char('名称')
# 关联刀具物料
cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料')
remark = fields.Char('备注')
# 刀柄
class Handle(models.Model):
_name = 'sf.handle'
_description = '刀柄'
code = fields.Char('编码')
name = fields.Char('型号名称')
# 关联刀具物料
cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料')
# 刀柄类型字段,关联刀柄类型对象
handle_model_number = fields.Many2one('sf.handle.model', '刀柄类型')
# 增加、刀柄类型、品牌、L(mm)、L1(mm)、D1(mm)、重量(kg)、材料型号、本体精度(mm)、配对螺母(mm)、适用夹头型号、夹持范围(mm)、检测精度、检测硬度、标准转速、图片、创建人、创建时间
brand = fields.Many2one('sf.machine.brand', '品牌')
length = fields.Float('L(mm)')
length1 = fields.Float('L1(mm)')
diameter1 = fields.Float('D1(mm)')
weight = fields.Float('重量(kg)')
material_model = fields.Many2one('sf.materials.model', '材料型号')
body_accuracy = fields.Float('本体精度(mm)')
nut = fields.Float('配对螺母(mm)')
chuck_model = fields.Many2many('sf.chuck.model', string='适用夹头型号')
clamping_range = fields.Float('夹持范围(mm)')
detection_accuracy = fields.Float('检测精度')
detection_hardness = fields.Char('检测硬度')
standard_speed = fields.Float('标准转速')
image = fields.Binary('图片')
# 刀柄类型
class HandleModel(models.Model):
_name = 'sf.handle.model'
_description = '刀柄类型'
code = fields.Char('编码')
name = fields.Char('名称')
# 关联刀具物料
cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料')
remark = fields.Char('备注')
# 夹头对象(夹头型号对象)
class Chuck(models.Model):
_name = 'sf.chuck'
_description = '夹头'
_rec_name = 'code'
code = fields.Char('编码')
name = fields.Char('型号名称')
# 关联刀具物料
cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料')
# 夹头类型字段,关联夹头类型对象
chuck_model_number = fields.Many2one('sf.chuck.model', '夹头类型')
# 增加品牌、精度(mm)、外径(mm)、内径(mm)、高度(mm)、材料型号、配对螺母(mm)、适用刀柄型号、夹持范围(mm)、特性、图片、创建人、创建时间
brand = fields.Many2one('sf.machine.brand', '品牌')
accuracy = fields.Float('精度(mm)')
diameter = fields.Float('外径(mm)')
inner_diameter = fields.Float('内径(mm)')
height = fields.Float('高度(mm)')
material_model = fields.Many2one('sf.materials.model', '材料型号')
nut = fields.Float('配对螺母(mm)')
handle_model = fields.Many2many('sf.handle.model', string='适用刀柄型号')
clamping_range = fields.Float('夹持范围(mm)')
feature = fields.Char('特性')
image = fields.Binary('图片')
# 夹头类型
class ChuckModel(models.Model):
_name = 'sf.chuck.model'
_description = '夹头类型'
code = fields.Char('编码')
name = fields.Char('名称')
# 关联刀具物料
cutting_tool_material = fields.Many2one('sf.cutting.tool.material', '刀具物料')
remark = fields.Char('备注')

View File

@@ -97,7 +97,7 @@ class SfMaintenanceEquipment(models.Model):
control_system_id = fields.Many2one('sf.machine.control_system', control_system_id = fields.Many2one('sf.machine.control_system',
string="控制系统") string="控制系统")
# 多个机床型号对应一个机床 # 多个机床型号对应一个机床
brand_id = fields.Many2one('sf.machine.brand', string='品牌') brand_id = fields.Many2one('sf.machine.brand', string='品牌', domain="[('tag_ids.name', 'ilike', equipment_type)]")
type_id = fields.Many2one('sf.machine_tool.type', '型号') type_id = fields.Many2one('sf.machine_tool.type', '型号')
state = fields.Selection( state = fields.Selection(
@@ -154,48 +154,48 @@ class SfMaintenanceEquipment(models.Model):
result.append((parameter.id, name)) result.append((parameter.id, name))
return result return result
@api.constrains('rotate_speed') # @api.constrains('rotate_speed')
def _check_rotate_speed(self): # def _check_rotate_speed(self):
if self.rotate_speed <= 0: # if self.rotate_speed <= 0:
raise UserError("转速不能为0") # raise UserError("转速不能为0")
#
@api.constrains('precision') # @api.constrains('precision')
def _check_precision(self): # def _check_precision(self):
if self.precision <= 0.00: # if self.equipment_type == '机床' and self.precision <= 0.00:
raise UserError("加工精度不能为0") # raise UserError("加工精度不能为0")
#
@api.constrains('number_of_knife_library') # @api.constrains('number_of_knife_library')
def _check_number_of_knife_library(self): # def _check_number_of_knife_library(self):
if self.number_of_knife_library <= 0: # if self.equipment_type == '机床' and self.number_of_knife_library <= 0:
raise UserError("刀库数量不能为0") # raise UserError("刀库数量不能为0")
#
@api.constrains('x_axis') # @api.constrains('x_axis')
def _check_x_axis(self): # def _check_x_axis(self):
if self.x_axis <= 0: # if self.equipment_type == '机床' and self.x_axis <= 0:
raise UserError("加工行程里x轴不能为0") # raise UserError("加工行程里x轴不能为0")
#
@api.constrains('y_axis') # @api.constrains('y_axis')
def _check_y_axis(self): # def _check_y_axis(self):
if self.y_axis <= 0: # if self.equipment_type == '机床' and self.y_axis <= 0:
raise UserError("加工行程里y轴不能为0") # raise UserError("加工行程里y轴不能为0")
#
@api.constrains('z_axis') # @api.constrains('z_axis')
def _check_z_axis(self): # def _check_z_axis(self):
if self.z_axis <= 0: # if self.equipment_type == '机床' and self.z_axis <= 0:
raise UserError("加工行程里z轴不能为0") # raise UserError("加工行程里z轴不能为0")
#
@api.constrains('b_axis') # @api.constrains('b_axis')
def _check_b_axis(self): # def _check_b_axis(self):
if self.number_of_axles == '四轴': # if self.equipment_type == '机床' and self.number_of_axles == '四轴':
print(self.number_of_axles) # print(self.number_of_axles)
if self.b_axis <= 0: # if self.b_axis <= 0:
raise UserError("加工行程里b轴不能为0") # raise UserError("加工行程里b轴不能为0")
#
@api.constrains('c_axis') # @api.constrains('c_axis')
def _check_c_axis(self): # def _check_c_axis(self):
if self.number_of_axles == '五轴': # if self.equipment_type == '机床' and self.number_of_axles == '五轴':
if self.c_axis <= 0: # if self.c_axis <= 0:
raise UserError("加工行程里c轴不能为0") # raise UserError("加工行程里c轴不能为0")
@api.onchange('type_id') @api.onchange('type_id')
def get_type_info(self): def get_type_info(self):
@@ -316,6 +316,14 @@ class SfMaintenanceEquipment(models.Model):
robot_operating_temperature = fields.Char('环境温度') robot_operating_temperature = fields.Char('环境温度')
robot_operating_humidity = fields.Char('环境湿度') robot_operating_humidity = fields.Char('环境湿度')
# 其他参数(所有设备)
date_of_purchase = fields.Date('采购日期')
date_of_manufacture = fields.Date('出厂日期')
date_of_warranty = fields.Date('质保截至日期')
original_value = fields.Char('原值')
incomplete_value = fields.Char('残值')
@@ -338,25 +346,28 @@ class SfMaintenanceEquipment(models.Model):
machine_tool_list = [] machine_tool_list = []
if objs_all: if objs_all:
for item in objs_all: for item in objs_all:
images_ids_names = []
for a in self.env['maintenance.equipment.image'].search([('id', 'in', item.image_id.ids)]):
images_ids_names.append(a.name)
if item.machine_tool_picture != False: if item.machine_tool_picture != False:
image = base64.b64encode(item.machine_tool_picture).decode('utf-8') image = base64.b64encode(item.machine_tool_picture).decode('utf-8')
else: else:
image = False image = False
control_system_id = self.env['sf.machine.control_system'].sudo().browse(item.control_system_id.id).code
val = { val = {
'MTcode': item.MTcode, 'MTcode': item.MTcode,
'factory_token': token, 'factory_token': token,
'id': item.id, 'id': item.id,
'name': item.name, 'name': item.name,
'code': item.code, 'code': item.code,
'precision': item.precision,
'knife_type': item.knife_type, 'knife_type': item.knife_type,
'number_of_knife_library': item.number_of_knife_library, 'number_of_knife_library': item.number_of_knife_library,
'rotate_speed': item.rotate_speed, 'rotate_speed': item.rotate_speed,
'number_of_axles': item.number_of_axles, 'number_of_axles': item.number_of_axles,
'control_system_id': self.env['sf.machine.control_system'].search( 'control_system_id': control_system_id,
[('id', '=', item.control_system_id.id)]).code, 'type_id': self.env['sf.machine_tool.type'].sudo().browse(item.type_id.id).code,
'type_id': self.env['sf.machine_tool.type'].search([('id', '=', item.type_id.id)]).code, 'brand_id': self.env['sf.machine.brand'].sudo().browse(item.brand_id.id).code,
'brand_id': self.env['sf.machine.brand'].search([('id', '=', item.brand_id.id)]).code,
'supplier_id': item.supplier_id.id, 'supplier_id': item.supplier_id.id,
'x_axis': item.x_axis, 'x_axis': item.x_axis,
'y_axis': item.y_axis, 'y_axis': item.y_axis,
@@ -377,15 +388,19 @@ class SfMaintenanceEquipment(models.Model):
'machine_tool_H': item.machine_tool_H, 'machine_tool_H': item.machine_tool_H,
'feed_speed': item.feed_speed, 'feed_speed': item.feed_speed,
'tool_speed': item.tool_speed, 'tool_speed': item.tool_speed,
'distance': item.distance,
'taper': item.taper, 'taper': item.taper,
'torque': item.torque, 'torque': item.torque,
'motor_power': item.motor_power, 'motor_power': item.motor_power,
'tool_quality_max': item.tool_quality_max, 'tool_quality_max': item.tool_quality_max,
'tool_long_max': item.tool_long_max, 'tool_long_max': item.tool_long_max,
'tool_diameter_max': item.tool_diameter_max, 'tool_diameter_max': item.tool_diameter_max,
'precision_min': item.precision_min,
'precision_max': item.precision_max,
'distance_min': item.distance_min,
'distance_max': item.distance_max,
'tool_diameter_min': item.tool_diameter_min,
'machine_tool_category': item.machine_tool_category.code, 'machine_tool_category': item.machine_tool_category.code,
'image_id': images_ids_names
} }
machine_tool_list.append(val) machine_tool_list.append(val)
# kw = machine_tool_list # kw = machine_tool_list
@@ -564,7 +579,7 @@ class SfMaintenanceEquipment(models.Model):
if not next_requests: if not next_requests:
equipment._create_new_request1(equipment.overhaul_date) equipment._create_new_request1(equipment.overhaul_date)
image_id = fields.Many2many('maintenance.equipment.image', 'equipment_id', string='设备图文') image_id = fields.Many2many('maintenance.equipment.image', 'equipment_id', string='加工能力', domain="[('type', '=', '加工能力')]")
class SfRobotAxisNum(models.Model): class SfRobotAxisNum(models.Model):

File diff suppressed because it is too large Load Diff

View File

@@ -21,14 +21,14 @@ class ResConfigSettings(models.TransientModel):
def sf_all_sync(self): def sf_all_sync(self):
try: try:
self.env['sf.international.standards'].sync_all_mrs_international_standards()
_logger.info("同步资源库国际标准完成")
self.env['material.apply'].sync_all_material_apply()
_logger.info("同步资源库材料应用完成")
self.env['sf.production.materials'].sync_all_production_materials() self.env['sf.production.materials'].sync_all_production_materials()
_logger.info("同步资源库材料") _logger.info("同步资源库材料")
self.env['sf.materials.model'].sync_all_materials_model() self.env['sf.materials.model'].sync_all_materials_model()
_logger.info("同步资源库材料型号") _logger.info("同步资源库材料型号")
self.env['sf.international.standards'].sync_all_mrs_international_standards()
_logger.info("同步资源库国际标准完成")
self.env['material.apply'].sync_all_material_apply()
_logger.info("同步资源库材料应用完成")
self.env['sf.production.process.category'].sync_all_production_process_category() self.env['sf.production.process.category'].sync_all_production_process_category()
_logger.info("同步资源库表面工艺类别") _logger.info("同步资源库表面工艺类别")
self.env['sf.production.process'].sync_all_production_process() self.env['sf.production.process'].sync_all_production_process()
@@ -48,9 +48,6 @@ class ResConfigSettings(models.TransientModel):
self.env['sf.cutting.tool.material'].sync_all_cutting_tool_material() self.env['sf.cutting.tool.material'].sync_all_cutting_tool_material()
_logger.info("同步刀具类型") _logger.info("同步刀具类型")
self.env['sf.cutting.tool.type'].sync_all_tool_type() self.env['sf.cutting.tool.type'].sync_all_tool_type()
_logger.info("同步所有刀具类型完成")
# _logger.info("同步所有刀具型号...")
# self.env['sf.cutting.tool.model'].sync_all_tool_model()
_logger.info("同步所有刀具型号完成") _logger.info("同步所有刀具型号完成")
self.env['sf.functional.cutting.tool.model'].sync_all_functional_cutting_tool_model() self.env['sf.functional.cutting.tool.model'].sync_all_functional_cutting_tool_model()
_logger.info("同步夹具物料") _logger.info("同步夹具物料")
@@ -65,6 +62,8 @@ class ResConfigSettings(models.TransientModel):
_logger.info("同步资源库机床型号完成") _logger.info("同步资源库机床型号完成")
self.env['sf.cutting_tool.standard.library'].sync_all_cutting_tool_standard_library() self.env['sf.cutting_tool.standard.library'].sync_all_cutting_tool_standard_library()
_logger.info("同步刀具标准库完成") _logger.info("同步刀具标准库完成")
self.env['maintenance.equipment.image'].sync_all_maintenance_equipment_image()
_logger.info("同步能力特征库")
except Exception as e: except Exception as e:
_logger.info("捕获错误信息:%s" % e) _logger.info("捕获错误信息:%s" % e)
raise ValidationError("数据错误导致同步失败,请联系管理员") raise ValidationError("数据错误导致同步失败,请联系管理员")

View File

@@ -756,7 +756,7 @@ class FunctionalToolAssembly(models.Model):
domain=[('cutting_tool_material_id', '=', '整体式刀具')]) domain=[('cutting_tool_material_id', '=', '整体式刀具')])
integral_code = fields.Char('整体式刀具序列号', readonly=True) integral_code = fields.Char('整体式刀具序列号', readonly=True)
integral_name = fields.Char('整体式刀具名称', readonly=True) integral_name = fields.Char('整体式刀具名称', readonly=True)
sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', '整体式刀具品牌', readonly=True) sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', '整体式刀具品牌', readonly=True, domain="[('tag_ids.name', 'ilike', '刀具')]")
# 刀片型号 # 刀片型号
cutting_tool_blade_model_id = fields.Many2one('product.product', string='刀片型号', readonly=True, cutting_tool_blade_model_id = fields.Many2one('product.product', string='刀片型号', readonly=True,
domain=[('cutting_tool_material_id', '=', '刀片')]) domain=[('cutting_tool_material_id', '=', '刀片')])

View File

@@ -19,7 +19,7 @@ class SfToolMaterialSearch(models.Model):
mrs_cutting_tool_material_name = fields.Char(related='mrs_cutting_tool_material_id.name', string='刀具物料名称', mrs_cutting_tool_material_name = fields.Char(related='mrs_cutting_tool_material_id.name', string='刀具物料名称',
store=True) store=True)
cutting_tool_type = fields.Char(related='mrs_cutting_tool_material_id.name', string='刀具物料类型', store=True) cutting_tool_type = fields.Char(related='mrs_cutting_tool_material_id.name', string='刀具物料类型', store=True)
mrs_machine_brand_id = fields.Many2one('sf.machine.brand', '品牌', required=True) mrs_machine_brand_id = fields.Many2one('sf.machine.brand', '品牌', required=True, domain="[('tag_ids.name', 'ilike', '刀具')]")
# 关联刀具型号 # 关联刀具型号
# mrs_cutting_tool_model_id = fields.Many2one('sf.cutting.tool.model', '刀具型号') # mrs_cutting_tool_model_id = fields.Many2one('sf.cutting.tool.model', '刀具型号')