Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/修改机床参数bug

This commit is contained in:
qihao.gong@jikimo.com
2023-09-01 16:57:24 +08:00
8 changed files with 75 additions and 69 deletions

View File

@@ -121,20 +121,12 @@ td.o_required_modifier {
//font-weight: bold; //font-weight: bold;
} }
.o_list_table th > div > i { .text-truncate {
display: none !important; overflow: unset !important;
text-overflow: unset !important;
white-space: unset !important;
} }
body .o_list_table th:nth-child(4) { .o_list_renderer .o_list_table tbody > tr > td:not(.o_list_record_selector):not(.o_handle_cell):not(.o_list_button):not(.o_list_record_remove) {
width: 100px !important; white-space: nowrap !important;
}
//body .o_list_table th:nth-child(5) {
// width: 500px !important;
//}
.o_list_renderer .o_list_table tbody > tr > td:not(.o_list_record_selector):not(.o_handle_cell):not(.o_list_button):not(.o_list_record_remove).o_list_text {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
} }

View File

@@ -159,11 +159,11 @@
<field name="feed_speed" required="1"/> <field name="feed_speed" required="1"/>
<label for="precision_min" string="X轴定位精度(mm)"/> <label for="precision_min" string="X轴定位精度(mm)"/>
<div class="test_model"> <div class="test_model">
<label for="precision_min" string="最小(min)"/> <label for="precision_min" string="最小"/>
<field name="precision_min" class="o_address_zip" required="1" <field name="precision_min" class="o_address_zip" required="1"
options="{'format': false}"/> options="{'format': false}"/>
<span>&amp;nbsp;</span> <span>&amp;nbsp;</span>
<label for="precision_max" string="最大(max)"/> <label for="precision_max" string="最大"/>
<field name="precision_max" class="o_address_zip" required="1" <field name="precision_max" class="o_address_zip" required="1"
options="{'format': false}"/> options="{'format': false}"/>
</div> </div>
@@ -210,27 +210,28 @@
<field name="motor_power" required="1"/> <field name="motor_power" required="1"/>
<label for="distance_min" string="主轴端面-工作台距离(mm)"/> <label for="distance_min" string="主轴端面-工作台距离(mm)"/>
<div class="test_model"> <div class="test_model">
<label for="distance_min" string="最小(min)"/> <label for="distance_min" string="最小"/>
<field name="distance_min" class="o_address_zip" required="1" <field name="distance_min" class="o_address_zip" required="1"
options="{'format': false}"/> options="{'format': false}"/>
<span>&amp;nbsp;</span> <span>&amp;nbsp;</span>
<label for="distance_max" string="最大(max)"/> <label for="distance_max" string="最大"/>
<field name="distance_max" class="o_address_zip" required="1" <field name="distance_max" class="o_address_zip" required="1"
options="{'format': false}"/> options="{'format': false}"/>
</div> </div>
<field name="guide_rail" required="1"/> <field name="guide_rail" required="1"/>
</group> </group>
<group></group>
<group string="刀具"> <group string="刀具">
<field name="knife_type" required="1"/> <field name="knife_type" required="1"/>
<field name="tool_speed" required="1"/> <field name="tool_speed" required="1"/>
<field name="tool_long_max" required="1"/> <field name="tool_long_max" required="1"/>
<label for="tool_diameter_min" string="刀具刀径(mm)"/> <label for="tool_diameter_min" string="刀具刀径(mm)"/>
<div class="test_model"> <div class="test_model">
<label for="tool_diameter_min" string="最小(min)"/> <label for="tool_diameter_min" string="最小"/>
<field name="tool_diameter_min" class="o_address_zip" required="1" <field name="tool_diameter_min" class="o_address_zip" required="1"
options="{'format': false}"/>Φ options="{'format': false}"/>Φ
<span>&amp;nbsp;</span> <span>&amp;nbsp;</span>
<label for="tool_diameter_max" string="最大(max)"/> <label for="tool_diameter_max" string="最大"/>
<field name="tool_diameter_max" class="o_address_zip" required="1" <field name="tool_diameter_max" class="o_address_zip" required="1"
options="{'format': false}"/>Φ options="{'format': false}"/>Φ
</div> </div>

View File

@@ -350,7 +350,7 @@
<field name="name">加工工艺</field> <field name="name">加工工艺</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">sf.processing.technology</field> <field name="res_model">sf.processing.technology</field>
<field name="view_mode">tree,form</field> <field name="view_mode">tree</field>
</record> </record>
<record id="sf_production_process_category" model="ir.actions.act_window"> <record id="sf_production_process_category" model="ir.actions.act_window">

View File

@@ -135,7 +135,6 @@ class ResMrpWorkOrder(models.Model):
self.functional_fixture_code = self.functional_fixture_id.code self.functional_fixture_code = self.functional_fixture_id.code
self.functional_fixture_type_id = self.functional_fixture_id.type_id.id self.functional_fixture_type_id = self.functional_fixture_id.type_id.id
def get_no_data(self, production_id): def get_no_data(self, production_id):
process_parameter_workorder = self.search( process_parameter_workorder = self.search(
[('surface_technics_parameters_id', '!=', False), ('production_id', '=', production_id)]) [('surface_technics_parameters_id', '!=', False), ('production_id', '=', production_id)])
@@ -400,20 +399,6 @@ class ResMrpWorkOrder(models.Model):
try: try:
cnc = self.env['mrp.workorder'].search( cnc = self.env['mrp.workorder'].search(
[('routing_type', '=', 'CNC加工'), ('production_id', '=', self.production_id.id)], limit=1) [('routing_type', '=', 'CNC加工'), ('production_id', '=', self.production_id.id)], limit=1)
logging.info('fetchCNC-cnc:%s' % cnc)
# if cnc.product_id.upload_model_file:
# logging.info('fetchCNC-upload_model_file:%s' % cnc.product_id.upload_model_file)
# attachments = cnc.product_id.upload_model_file[0]
# logging.info('fetchCNC-attachment1:%s' % attachments)
# logging.info('fetchCNC-attachment1:%s' % cnc.product_id.upload_model_file[0])
# logging.info('fetchCNC-attachment2:%s' % cnc.product_id.upload_model_file[0].datas)
# logging.info('fetchCNC-attachment:%s' % attachments.datas)
# base64_data = base64.b64encode(attachments.datas)
# logging.info('fetchCNC-attachment1:%s' % attachments)
# base64_datas = base64_data.decode('utf-8')
# model_code = hashlib.sha1(base64_datas.encode('utf-8')).hexdigest()
# logging.info('fetchCNC-model_code:%s' % model_code)
logging.info('fetchCNC-model_code1:%s' % cnc.product_id.model_code)
res = {'model_code': '' if not cnc.product_id.model_code else cnc.product_id.model_code, res = {'model_code': '' if not cnc.product_id.model_code else cnc.product_id.model_code,
'production_no': self.production_id.name, 'production_no': self.production_id.name,
'machine_tool_code': cnc.workcenter_id.machine_tool_id.code, 'machine_tool_code': cnc.workcenter_id.machine_tool_id.code,
@@ -427,6 +412,7 @@ class ResMrpWorkOrder(models.Model):
'embryo_height': cnc.product_id.bom_ids.bom_line_ids.product_id.height, 'embryo_height': cnc.product_id.bom_ids.bom_line_ids.product_id.height,
'embryo_width': cnc.product_id.bom_ids.bom_line_ids.product_id.width, 'embryo_width': cnc.product_id.bom_ids.bom_line_ids.product_id.width,
'order_no': cnc.production_id.origin, 'order_no': cnc.production_id.origin,
'model_order_no': cnc.product_id.default_code.rsplit('-', 1)[0],
'user': self.env.user.name, 'user': self.env.user.name,
'model_file': '' if not cnc.product_id.model_file else base64.b64encode( 'model_file': '' if not cnc.product_id.model_file else base64.b64encode(
cnc.product_id.model_file).decode('utf-8') cnc.product_id.model_file).decode('utf-8')

View File

@@ -472,3 +472,22 @@ class ReStockMove(models.Model):
item.product_id.write({'register_state': '注册失败'}) item.product_id.write({'register_state': '注册失败'})
except Exception as e: except Exception as e:
raise UserError("注册刀具到云端失败,请联系管理员!") raise UserError("注册刀具到云端失败,请联系管理员!")
class ReStockQuant(models.Model):
_inherit = 'stock.quant'
def action_apply_inventory(self):
inventory_diff_quantity = self.inventory_diff_quantity
super(ReStockQuant, self).action_apply_inventory()
if inventory_diff_quantity >= 1:
stock = self.env['stock.move'].search([('product_id', '=', self.product_id.id), ('is_inventory', '=', True),
('reference', '=', '更新的产品数量'), ('state', '=', 'done')],
limit=1, order='id desc')
if self.product_id.categ_type == '夹具':
stock._register_fixture()
elif self.product_id.categ_type == '刀具':
stock._register_cutting_tool()
return True

View File

@@ -37,11 +37,11 @@ class QuickEasyOrder(models.Model):
quantity = fields.Integer('数量', default=1) quantity = fields.Integer('数量', default=1)
unit_price = fields.Float('单价') unit_price = fields.Float('单价')
price = fields.Float('总价') price = fields.Float('总价')
model_file = fields.Binary('模型文件') model_file = fields.Binary('glb模型文件')
upload_model_file = fields.Many2many('ir.attachment', 'upload_qf_model_file_attachment_ref', string='模型文件') upload_model_file = fields.Many2many('ir.attachment', 'upload_qf_model_file_attachment_ref', string='上传模型文件')
delivery_time = fields.Date('交货日期') delivery_time = fields.Date('交货日期')
customer_id = fields.Many2one('res.partner', string='客户', default=lambda self: self.env.user.partner_id.id) customer_id = fields.Many2one('res.partner', string='客户', default=lambda self: self.env.user.partner_id.id)
state = fields.Selection([('草稿', '草稿'), ('付款', '待付款'), ('派单', '待派单'), state = fields.Selection([('草稿', '草稿'), ('待派单', '待派单'),
('待接单', '待接单'), ('加工中', '加工中'), ('待接单', '待接单'), ('加工中', '加工中'),
('物流中', '物流中'), ('已交付', '已交付')], string='订单状态', default='草稿', ('物流中', '物流中'), ('已交付', '已交付')], string='订单状态', default='草稿',
readonly=True) readonly=True)
@@ -82,6 +82,7 @@ class QuickEasyOrder(models.Model):
obj = super(QuickEasyOrder, self).create(vals) obj = super(QuickEasyOrder, self).create(vals)
self.model_coloring(obj) self.model_coloring(obj)
self.distribute_to_factory(obj) self.distribute_to_factory(obj)
obj.state = '待接单'
return obj return obj
# 将attach的datas内容转为glb文件 # 将attach的datas内容转为glb文件

View File

@@ -6,6 +6,7 @@
<field name="code">quick.easy.order</field> <field name="code">quick.easy.order</field>
<field name="prefix">FP-%(year)s-%(month)s%(day)s-</field> <field name="prefix">FP-%(year)s-%(month)s%(day)s-</field>
<field name="padding">4</field> <field name="padding">4</field>
<field name="company_id" eval="False"/>
</record> </record>
# ---------- 快速订单 ------------ # ---------- 快速订单 ------------
@@ -15,13 +16,16 @@
<field name="model">quick.easy.order</field> <field name="model">quick.easy.order</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="快速订单"> <tree string="快速订单">
<field optional="show" name="name" string="订单号"/> <field name="state" widget="label_selection"
<field optional="show" name="customer_id" string="客户"/> options="{'classes': {'待接单': 'default', '加工中':'primary','物流中':'warning','已交付': 'success'}}"/>
<field optional="show" name="material_id"/> <field name="name" string="订单号"/>
<field optional="show" name="material_model_id"/> <field name="customer_id" string="客户"/>
<field optional="show" name="parameter_ids"/> <field name="material_id"/>
<field optional="show" name="quantity"/> <field name="material_model_id"/>
<field optional="show" name="price"/> <field name="parameter_ids" string="表面工艺参数" widget="many2many_tags"/>
<field name="quantity"/>
<field name="unit_price"/>
<field name="price"/>
<field optional="hide" name="delivery_time"/> <field optional="hide" name="delivery_time"/>
</tree> </tree>
</field> </field>
@@ -32,6 +36,9 @@
<field name="model">quick.easy.order</field> <field name="model">quick.easy.order</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="快速订单"> <form string="快速订单">
<header>
<field name="state" widget="statusbar"/>
</header>
<sheet> <sheet>
<h1> <h1>
<field name="name" readonly="True"/> <field name="name" readonly="True"/>
@@ -41,7 +48,7 @@
<field name="customer_id" readonly="1" force_save="1"/> <field name="customer_id" readonly="1" force_save="1"/>
<field name="material_id"/> <field name="material_id"/>
<field name="material_model_id"/> <field name="material_model_id"/>
<!-- <field name="process_id"/>--> <!-- <field name="process_id"/>-->
<field name="parameter_ids" widget="many2many_tags" string="表面工艺参数"/> <field name="parameter_ids" widget="many2many_tags" string="表面工艺参数"/>
<field name="machining_precision"/> <field name="machining_precision"/>
<field name="quantity"/> <field name="quantity"/>
@@ -80,7 +87,7 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<search string="快速订单"> <search string="快速订单">
<field name="name" string="模糊搜索" <field name="name" string="模糊搜索"
filter_domain="['|', ('name', 'ilike', self), '|', ('receive_name', 'ilike', self),'|', ('receive_phone', 'ilike', self),('customer_id', 'ilike', self)]"/> filter_domain="['|', ('name', 'ilike', self), '|',('customer_id', 'ilike', self)]"/>
<separator/> <separator/>
<field name="customer_id"/> <field name="customer_id"/>
</search> </search>

View File

@@ -10,7 +10,7 @@ class SfLocation(models.Model):
# 重写字段定义 # 重写字段定义
name = fields.Char('Location Name', required=True, size=20) name = fields.Char('Location Name', required=True, size=20)
barcode = fields.Char('Barcode', copy=False, required=True, size=15) barcode = fields.Char('Barcode', copy=False, size=15)
# 仓库类别selection库区、库位、货位 # 仓库类别selection库区、库位、货位
location_type = fields.Selection([ location_type = fields.Selection([
@@ -34,14 +34,14 @@ class SfLocation(models.Model):
# 产品类别 关联product.category # 产品类别 关联product.category
product_type = fields.Many2many('product.category', string='产品类别') product_type = fields.Many2many('product.category', string='产品类别')
# 货架独有字段通道、方向、货架高度m、货架层数、层数容量 # 货架独有字段通道、方向、货架高度m、货架层数、层数容量
channel = fields.Char(string='通道', required=True) channel = fields.Char(string='通道')
direction = fields.Selection([ direction = fields.Selection([
('R', 'R'), ('R', 'R'),
('L', 'L') ('L', 'L')
], string='方向', required=True) ], string='方向')
shelf_height = fields.Float(string='货架高度(m)') shelf_height = fields.Float(string='货架高度(m)')
shelf_layer = fields.Integer(string='货架层数', required=True) shelf_layer = fields.Integer(string='货架层数')
layer_capacity = fields.Integer(string='层数容量', required=True) layer_capacity = fields.Integer(string='层数容量')
# 货位独有字段:货位状态、产品(关联产品对象)、产品序列号(关联产品序列号对象) # 货位独有字段:货位状态、产品(关联产品对象)、产品序列号(关联产品序列号对象)
location_status = fields.Selection([ location_status = fields.Selection([
@@ -54,9 +54,9 @@ class SfLocation(models.Model):
product_sn_id = fields.Many2one('stock.lot', string='产品序列号') product_sn_id = fields.Many2one('stock.lot', string='产品序列号')
# time_test = fields.Char(string='time') # time_test = fields.Char(string='time')
# 添加SQL约束 # 添加SQL约束
_sql_constraints = [ # _sql_constraints = [
('name_uniq', 'unique(name)', '位置名称必须唯一!'), # ('name_uniq', 'unique(name)', '位置名称必须唯一!'),
] # ]
hide_location_type = fields.Boolean(compute='_compute_hide_what', string='隐藏仓库') hide_location_type = fields.Boolean(compute='_compute_hide_what', string='隐藏仓库')
hide_area = fields.Boolean(compute='_compute_hide_what', string='隐藏库区') hide_area = fields.Boolean(compute='_compute_hide_what', string='隐藏库区')