Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/修复工件配送
# Conflicts: # sf_manufacturing/models/mrp_workorder.py
This commit is contained in:
@@ -4,7 +4,7 @@ csv_internal_sep = ,
|
||||
data_dir = /var/lib/odoo
|
||||
db_host = 172.17.0.2
|
||||
db_maxconn = 64
|
||||
db_name = sf_t2cs_003
|
||||
db_name = sf_t_0430
|
||||
db_password = sf
|
||||
db_port = 5432
|
||||
db_sslmode = prefer
|
||||
|
||||
@@ -409,6 +409,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
work.compensation_value_y = eval(self.material_center_point)[1]
|
||||
work.process_state = '待加工'
|
||||
self.sudo().production_id.state = 'pending_processing'
|
||||
self.date_finished = datetime.now()
|
||||
workorder.button_finish()
|
||||
|
||||
except Exception as e:
|
||||
@@ -699,6 +700,12 @@ class ResMrpWorkOrder(models.Model):
|
||||
def button_start(self):
|
||||
if self.routing_type == '装夹预调' and self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name:
|
||||
self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name
|
||||
|
||||
if self.routing_type == '解除装夹':
|
||||
'''
|
||||
记录开始时间
|
||||
'''
|
||||
self.date_start = datetime.now()
|
||||
# 外协出库单,从“正在等待”变为“就绪”状态
|
||||
if self.is_subcontract is True:
|
||||
picking_out = self.env['stock.picking'].search([('id', '=', self.picking_out_id.id)])
|
||||
@@ -769,7 +776,11 @@ class ResMrpWorkOrder(models.Model):
|
||||
raise UserError("请对前置三元检测定位参数进行计算定位")
|
||||
if not self.rfid_code:
|
||||
raise UserError("请扫RFID码进行绑定")
|
||||
# self.workpiece_delivery_ids[0].write({'status': '待下发'})
|
||||
if self.routing_type == '解除装夹':
|
||||
'''
|
||||
记录结束时间
|
||||
'''
|
||||
self.date_finished = datetime.now()
|
||||
if self.picking_out_id:
|
||||
picking_out = self.env['stock.picking'].search([('id', '=', self.picking_out_id.id)])
|
||||
if picking_out.workorder_out_id:
|
||||
@@ -1020,6 +1031,7 @@ class SfWorkOrderBarcodes(models.Model):
|
||||
item.write({'rfid_code': barcode})
|
||||
logging.info("Rfid绑定成功!!!")
|
||||
self.process_state = '待检测'
|
||||
self.date_start = datetime.now()
|
||||
else:
|
||||
raise UserError('该托盘信息不存在!!!')
|
||||
# stock_move_line = self.env['stock.move.line'].search([('lot_name', '=', barcode)])
|
||||
|
||||
@@ -380,7 +380,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//search" position="inside">
|
||||
<searchpanel class="account_root">
|
||||
<field name="state" icon="fa-filter"/>
|
||||
<field name="state" icon="fa-filter" enable_counters="1"/>
|
||||
</searchpanel>
|
||||
</xpath>
|
||||
<filter name='todo' position="replace"/>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<attribute name="attrs">{'invisible':
|
||||
['|',("user_permissions","=",False),("name","=","获取CNC加工程序")]}
|
||||
</attribute>
|
||||
<attribute name="string">停工</attribute>
|
||||
<!-- <attribute name="string">停工</attribute> -->
|
||||
</xpath>
|
||||
<xpath expr="//button[@name='action_open_wizard']" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
@@ -111,23 +111,36 @@
|
||||
<field name='name' invisible="1"/>
|
||||
<field name='is_delivery' invisible="1"/>
|
||||
<!-- 工单form页面的开始停工按钮等 -->
|
||||
<!-- <button name="button_start" type="object" string="开始" class="btn-success" -->
|
||||
<!-- attrs="{'invisible': ['|', '|', ('production_state', 'not in', ('pending_processing', 'pending_cam', 'pending_era_cam')), ('state','!=','ready'), ('routing_type', 'not in', ('装夹预调', 'CNC加工', '解除装夹'))]}" -->
|
||||
<!-- groups="sf_base.group_sf_mrp_user"/> -->
|
||||
<!-- <button name="button_pending" type="object" string="暂停" class="btn-warning" -->
|
||||
<!-- attrs="{'invisible': ['|', '|', ('production_state', 'not in', ('pending_processing', 'pending_cam', 'pending_era_cam')), ('state','!=','progress'), ('routing_type', 'not in', ('装夹预调', 'CNC加工', '解除装夹'))]}" -->
|
||||
<!-- groups="sf_base.group_sf_mrp_user"/> -->
|
||||
<!-- <button name="button_finish" type="object" string="完成" class="btn-success" -->
|
||||
<!-- attrs="{'invisible': ['|', '|', ('production_state', 'not in', ('pending_processing', 'pending_cam', 'pending_era_cam')), ('state','!=','progress'), ('routing_type', 'not in', ('装夹预调', 'CNC加工', '解除装夹'))]}" -->
|
||||
<!-- groups="sf_base.group_sf_mrp_user" confirm="是否确认完工"/> -->
|
||||
|
||||
<button name="button_start" type="object" string="开始" class="btn-success"
|
||||
attrs="{'invisible': ['|', ('production_state', '!=', 'pending_processing'), ('state','!=','ready')]}"
|
||||
groups="sf_base.group_sf_mrp_user"/>
|
||||
attrs="{'invisible': ['|', '|', '|', ('production_state','in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('state', 'in', ('done', 'cancel')), ('is_user_working', '!=', False)]}"/>
|
||||
<button name="button_pending" type="object" string="暂停" class="btn-warning"
|
||||
attrs="{'invisible': ['|', ('production_state', '!=', 'pending_processing'), ('state','!=','progress')]}"
|
||||
groups="sf_base.group_sf_mrp_user"/>
|
||||
attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False)]}"/>
|
||||
<button name="button_finish" type="object" string="完成" class="btn-success"
|
||||
attrs="{'invisible': ['|', ('production_state', '!=', 'pending_processing'), ('state','!=','progress')]}"
|
||||
groups="sf_base.group_sf_mrp_user" confirm="是否确认完工"/>
|
||||
<button name="%(mrp.act_mrp_block_workcenter_wo)d" type="action" string="停工"
|
||||
context="{'default_workcenter_id': workcenter_id}" class="btn-danger"
|
||||
groups="sf_base.group_sf_mrp_user"
|
||||
attrs="{'invisible': ['|', ('production_state', '!=', 'pending_processing'), ('state','!=','progress')]}"/>
|
||||
<button name="button_unblock" type="object" string="Unblock"
|
||||
context="{'default_workcenter_id': workcenter_id}" class="btn-danger"
|
||||
groups="sf_base.group_sf_mrp_user"
|
||||
attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '!=', 'blocked'),('state','=','done')]}"/>
|
||||
attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False)]}"/>
|
||||
|
||||
<button name="%(mrp.act_mrp_block_workcenter_wo)d" type="action" string="阻塞" context="{'default_workcenter_id': workcenter_id}" class="btn-danger"
|
||||
attrs="{'invisible': ['|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked')]}"/>
|
||||
<button name="button_unblock" type="object" string="取消阻塞" context="{'default_workcenter_id': workcenter_id}" class="btn-danger"
|
||||
attrs="{'invisible': ['|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '!=', 'blocked')]}"/>
|
||||
|
||||
<!-- <button name="%(mrp.act_mrp_block_workcenter_wo)d" type="action" string="停工" -->
|
||||
<!-- context="{'default_workcenter_id': workcenter_id}" class="btn-danger" -->
|
||||
<!-- groups="sf_base.group_sf_mrp_user" -->
|
||||
<!-- attrs="{'invisible': ['|', ('production_state', '!=', 'pending_processing'), ('state','!=','progress')]}"/> -->
|
||||
<!-- <button name="button_unblock" type="object" string="Unblock" -->
|
||||
<!-- context="{'default_workcenter_id': workcenter_id}" class="btn-danger" -->
|
||||
<!-- groups="sf_base.group_sf_mrp_user" -->
|
||||
<!-- attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '!=', 'blocked'),('state','=','done')]}"/> -->
|
||||
<button name="button_workpiece_delivery" type="object" string="工件配送" class="btn-primary"
|
||||
attrs="{'invisible': ['|',('routing_type','!=','装夹预调'),('is_delivery','=',True)]}"/>
|
||||
|
||||
|
||||
@@ -345,7 +345,7 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
|
||||
# 创建装刀请求
|
||||
knife_plan.apply_for_tooling()
|
||||
else:
|
||||
logging.info('功能刀具【%s】满足CNC用刀需求!!!')
|
||||
logging.info('功能刀具【%s】满足CNC用刀需求!!!' % cnc_processing.cutting_tool_name)
|
||||
|
||||
|
||||
class FunctionalToolAssembly(models.Model):
|
||||
@@ -769,6 +769,15 @@ class FunctionalToolDismantle(models.Model):
|
||||
chuck_freight_id = fields.Many2one('sf.shelf.location', '夹头目标货位',
|
||||
domain="[('product_id', 'in', (chuck_product_id, False))]")
|
||||
|
||||
@api.onchange('functional_tool_id')
|
||||
def _onchange_freight(self):
|
||||
for item in self:
|
||||
item.integral_freight_id = False
|
||||
item.blade_freight_id = False
|
||||
item.bar_freight_id = False
|
||||
item.pad_freight_id = False
|
||||
item.chuck_freight_id = False
|
||||
|
||||
@api.depends('functional_tool_id')
|
||||
def _compute_functional_tool_num(self):
|
||||
for item in self:
|
||||
@@ -807,10 +816,12 @@ class FunctionalToolDismantle(models.Model):
|
||||
raise ValidationError('Rfid为【%s】的功能刀具已经拆解,请勿重复操作!' % self.functional_tool_id.rfid_dismantle)
|
||||
location = self.env['stock.location'].search([('name', '=', '刀具组装位置')])
|
||||
location_dest = self.env['stock.location'].search([('name', '=', '刀具房')])
|
||||
# =================刀柄是否报废拆解=======
|
||||
# =================刀柄是否[报废]拆解=======
|
||||
location_dest_scrap = self.env['stock.location'].search([('name', '=', 'Scrap')])
|
||||
if self.handle_rfid:
|
||||
lot = self.env['stock.lot'].sudo().search([('rfid', '=', self.handle_rfid)])
|
||||
if not lot:
|
||||
raise ValidationError('Rfid为【%s】的功能刀具序列号不存在!' % self.handle_rfid)
|
||||
functional_tool_assembly = self.functional_tool_id.functional_tool_name_id
|
||||
if self.scrap_boolean:
|
||||
# 刀柄报废 入库到Scrap
|
||||
@@ -820,34 +831,34 @@ class FunctionalToolDismantle(models.Model):
|
||||
# 刀柄不报废 入库到刀具房
|
||||
lot.create_stock_quant(location, location_dest, functional_tool_assembly.id, '功能刀具拆解',
|
||||
functional_tool_assembly, functional_tool_assembly.tool_groups_id)
|
||||
# ==============功能刀具报废拆解================
|
||||
# ==============功能刀具[报废]拆解================
|
||||
if self.dismantle_cause in ['寿命到期报废', '崩刀报废']:
|
||||
# 除刀柄外物料报废 入库到Scrap
|
||||
if self.integral_freight_id:
|
||||
if self.integral_product_id:
|
||||
self.integral_product_id.dismantle_stock_moves(False, location, location_dest_scrap)
|
||||
elif self.blade_freight_id:
|
||||
elif self.blade_product_id:
|
||||
self.blade_product_id.dismantle_stock_moves(False, location, location_dest_scrap)
|
||||
if self.bar_freight_id:
|
||||
if self.bar_product_id:
|
||||
self.bar_product_id.dismantle_stock_moves(False, location, location_dest_scrap)
|
||||
elif self.pad_freight_id:
|
||||
elif self.pad_product_id:
|
||||
self.pad_product_id.dismantle_stock_moves(False, location, location_dest_scrap)
|
||||
if self.chuck_freight_id:
|
||||
if self.chuck_product_id:
|
||||
self.chuck_product_id.dismantle_stock_moves(False, location, location_dest_scrap)
|
||||
# ===========功能刀具磨削拆解==============
|
||||
# ===========功能刀具[磨削]拆解==============
|
||||
elif self.dismantle_cause in ['刀具需磨削']:
|
||||
location_dest = self.env['stock.location'].search([('name', '=', '磨削房')])
|
||||
# 除刀柄外物料拆解 入库到具体库位
|
||||
if self.integral_freight_id:
|
||||
if self.integral_product_id:
|
||||
self.integral_product_id.dismantle_stock_moves(False, location, location_dest)
|
||||
elif self.blade_freight_id:
|
||||
elif self.blade_product_id:
|
||||
self.blade_product_id.dismantle_stock_moves(False, location, location_dest)
|
||||
if self.bar_freight_id:
|
||||
if self.bar_product_id:
|
||||
self.bar_product_id.dismantle_stock_moves(False, location, location_dest)
|
||||
elif self.pad_freight_id:
|
||||
elif self.pad_product_id:
|
||||
self.pad_product_id.dismantle_stock_moves(False, location, location_dest)
|
||||
if self.chuck_freight_id:
|
||||
if self.chuck_product_id:
|
||||
self.chuck_product_id.dismantle_stock_moves(False, location, location_dest)
|
||||
# ==============功能刀具更换拆解==============
|
||||
# ==============功能刀具[更换]拆解==============
|
||||
elif self.dismantle_cause in ['更换为其他刀具']:
|
||||
# 除刀柄外物料拆解 入库到具体库位
|
||||
if self.integral_freight_id:
|
||||
@@ -875,7 +886,7 @@ class FunctionalToolDismantle(models.Model):
|
||||
'rfid': '',
|
||||
'state': '已拆解'
|
||||
})
|
||||
logging.info('刀具拆解成功!')
|
||||
logging.info('【%s】刀具拆解成功!' % self.name)
|
||||
|
||||
|
||||
class ProductProduct(models.Model):
|
||||
@@ -895,12 +906,12 @@ class ProductProduct(models.Model):
|
||||
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', shelf_location_barcode)])
|
||||
location.product_num = location.product_num + 1
|
||||
else:
|
||||
location = False
|
||||
location = self.env['sf.shelf.location']
|
||||
# 创建移动历史记录
|
||||
stock_move_line_id = self.env['stock.move.line'].sudo().create({
|
||||
'product_id': self.id,
|
||||
'move_id': stock_move_id.id,
|
||||
'current_location_id': location.id or False,
|
||||
'current_location_id': location.id,
|
||||
'install_tool_time': fields.Datetime.now(),
|
||||
'qty_done': 1.0,
|
||||
'state': 'done',
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
<field name="barcode_ids">
|
||||
<tree create="0">
|
||||
<field name="name"/>
|
||||
<field name="rfid"/>
|
||||
<field name="tool_material_status"/>
|
||||
<!-- <button string="序列号注册" name="enroll_fixture_material_stock" type="object"-->
|
||||
<!-- class="btn-primary"/>-->
|
||||
|
||||
@@ -846,7 +846,8 @@
|
||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['寿命到期报废','崩刀报废'])], 'readonly': [('state', '=', '已拆解')]}"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="夹头" attrs="{'invisible': [('chuck_product_id', '=', False)]}">
|
||||
<group string="夹头"
|
||||
attrs="{'invisible': [('chuck_product_id', '=', False)]}">
|
||||
<group>
|
||||
<field name="chuck_product_id" string="名称"/>
|
||||
<field name="chuck_type_id" string="型号"/>
|
||||
@@ -855,7 +856,8 @@
|
||||
<group>
|
||||
<field name="chuck_freight_id" string="目标货位"
|
||||
options="{'no_create': True,'no_create_edit':True}"
|
||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')]}"/>
|
||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')],
|
||||
'required': [('chuck_product_id', '!=', False),('dismantle_cause', 'in', ['更换为其他刀具'])]}"/>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
@@ -869,7 +871,8 @@
|
||||
<group>
|
||||
<field name="integral_freight_id" string="目标货位"
|
||||
options="{'no_create': True,'no_create_edit':True}"
|
||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')]}"/>
|
||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')],
|
||||
'required': [('integral_product_id', '!=', False),('dismantle_cause', 'in', ['更换为其他刀具'])]}"/>
|
||||
|
||||
</group>
|
||||
</group>
|
||||
@@ -884,7 +887,8 @@
|
||||
<group>
|
||||
<field name="blade_freight_id" string="目标货位"
|
||||
options="{'no_create': True,'no_create_edit':True}"
|
||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')]}"/>
|
||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')],
|
||||
'required': [('blade_product_id', '!=', False),('dismantle_cause', 'in', ['更换为其他刀具'])]}"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="刀杆" attrs="{'invisible': [('bar_product_id', '=', False)]}">
|
||||
@@ -896,7 +900,8 @@
|
||||
<group>
|
||||
<field name="bar_freight_id" string="目标货位"
|
||||
options="{'no_create': True,'no_create_edit':True}"
|
||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')]}"/>
|
||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')],
|
||||
'required': [('bar_product_id', '!=', False),('dismantle_cause', 'in', ['更换为其他刀具'])]}"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="刀盘" attrs="{'invisible': [('pad_product_id', '=', False)]}">
|
||||
@@ -908,7 +913,8 @@
|
||||
<group>
|
||||
<field name="pad_freight_id" string="目标货位"
|
||||
options="{'no_create': True,'no_create_edit':True}"
|
||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')]}"/>
|
||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')],
|
||||
'required': [('pad_freight_id', '!=', False), ('dismantle_cause', 'in', ['更换为其他刀具'])]}"/>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
@@ -944,7 +950,5 @@
|
||||
<field name="search_view_id" ref="sf_functional_tool_dismantle_search"/>
|
||||
<field name="context">{'search_default_no_dismantle_state':1}</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
<field name="barcode_ids">
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
<field name="rfid"/>
|
||||
<field name="tool_material_status"/>
|
||||
<!-- <button name="enroll_tool_material_stock" string="序列号注册" type="object" class="btn-primary"/>-->
|
||||
</tree>
|
||||
|
||||
@@ -246,9 +246,20 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
if self.integral_freight_barcode:
|
||||
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', self.integral_freight_barcode)])
|
||||
if location:
|
||||
if not location.product_id:
|
||||
raise ValidationError('编码为【%s】的货位为空货位!' % location.barcode)
|
||||
else:
|
||||
material_name_id = location.product_id.cutting_tool_material_id
|
||||
if material_name_id and material_name_id.name == '整体式刀具':
|
||||
if location.product_num == 0:
|
||||
raise ValidationError('编码为【%s】的货位的产品库存数量为0,请重新选择!' % location.barcode)
|
||||
self.integral_product_id = location.product_id.id
|
||||
else:
|
||||
self.integral_product_id = False
|
||||
raise ValidationError(
|
||||
'编码为【%s】的货位存放的产品为【%s】,不是整体式刀具,请重新选择!' % (
|
||||
location.barcode, location.product_id.name))
|
||||
else:
|
||||
raise ValidationError('编码为【%s】的货位不存在!' % self.integral_freight_barcode)
|
||||
|
||||
# ===============刀片型号====================
|
||||
blade_freight_barcode = fields.Char('刀片货位')
|
||||
@@ -265,9 +276,20 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
if self.blade_freight_barcode:
|
||||
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', self.blade_freight_barcode)])
|
||||
if location:
|
||||
if not location.product_id:
|
||||
raise ValidationError('编码为【%s】的货位为空货位!' % location.barcode)
|
||||
else:
|
||||
material_name_id = location.product_id.cutting_tool_material_id
|
||||
if material_name_id and material_name_id.name == '刀片':
|
||||
if location.product_num == 0:
|
||||
raise ValidationError('编码为【%s】的货位的产品库存数量为0,请重新选择!' % location.barcode)
|
||||
self.blade_product_id = location.product_id.id
|
||||
else:
|
||||
self.blade_product_id = False
|
||||
raise ValidationError(
|
||||
'编码为【%s】的货位存放的产品为【%s】,不是刀片,请重新选择!' % (
|
||||
location.barcode, location.product_id.name))
|
||||
else:
|
||||
raise ValidationError('编码为【%s】的货位不存在!' % self.blade_freight_barcode)
|
||||
|
||||
# ====================刀杆型号==================
|
||||
bar_freight_barcode = fields.Char('刀杆货位')
|
||||
@@ -284,9 +306,20 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
if self.bar_freight_barcode:
|
||||
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', self.bar_freight_barcode)])
|
||||
if location:
|
||||
if not location.product_id:
|
||||
raise ValidationError('编码为【%s】的货位为空货位!' % location.barcode)
|
||||
else:
|
||||
material_name_id = location.product_id.cutting_tool_material_id
|
||||
if material_name_id and material_name_id.name == '刀杆':
|
||||
if location.product_num == 0:
|
||||
raise ValidationError('编码为【%s】的货位的产品库存数量为0,请重新选择!' % location.barcode)
|
||||
self.bar_product_id = location.product_id.id
|
||||
else:
|
||||
self.bar_product_id = False
|
||||
raise ValidationError(
|
||||
'编码为【%s】的货位存放的产品为【%s】,不是刀杆,请重新选择!' % (
|
||||
location.barcode, location.product_id.name))
|
||||
else:
|
||||
raise ValidationError('编码为【%s】的货位不存在!' % self.bar_freight_barcode)
|
||||
|
||||
# ===============刀盘型号===================
|
||||
pad_freight_barcode = fields.Char('刀盘货位')
|
||||
@@ -303,9 +336,20 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
if self.pad_freight_barcode:
|
||||
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', self.pad_freight_barcode)])
|
||||
if location:
|
||||
if not location.product_id:
|
||||
raise ValidationError('编码为【%s】的货位为空货位!' % location.barcode)
|
||||
else:
|
||||
material_name_id = location.product_id.cutting_tool_material_id
|
||||
if material_name_id and material_name_id.name == '刀盘':
|
||||
if location.product_num == 0:
|
||||
raise ValidationError('编码为【%s】的货位的产品库存数量为0,请重新选择!' % location.barcode)
|
||||
self.pad_product_id = location.product_id.id
|
||||
else:
|
||||
self.pad_product_id = False
|
||||
raise ValidationError(
|
||||
'编码为【%s】的货位存放的产品为【%s】,不是刀盘,请重新选择!' % (
|
||||
location.barcode, location.product_id.name))
|
||||
else:
|
||||
raise ValidationError('编码为【%s】的货位不存在!' % self.pad_freight_barcode)
|
||||
|
||||
# ================刀柄型号===============
|
||||
handle_freight_rfid = fields.Char('刀柄Rfid', compute='_compute_rfid')
|
||||
@@ -342,12 +386,22 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
if self.chuck_freight_barcode:
|
||||
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', self.chuck_freight_barcode)])
|
||||
if location:
|
||||
if not location.product_id:
|
||||
raise ValidationError('编码为【%s】的货位为空货位!' % location.barcode)
|
||||
else:
|
||||
material_name_id = location.product_id.cutting_tool_material_id
|
||||
if material_name_id and material_name_id.name == '夹头':
|
||||
if location.product_num == 0:
|
||||
raise ValidationError('编码为【%s】的货位的产品库存数量为0,请重新选择!' % location.barcode)
|
||||
self.chuck_product_id = location.product_id.id
|
||||
else:
|
||||
self.chuck_product_id = False
|
||||
raise ValidationError(
|
||||
'编码为【%s】的货位存放的产品为【%s】,不是夹头,请重新选择!' % (
|
||||
location.barcode, location.product_id.name))
|
||||
else:
|
||||
raise ValidationError('编码为【%s】的货位不存在!' % self.chuck_freight_barcode)
|
||||
|
||||
# ========================================
|
||||
|
||||
def on_barcode_scanned(self, barcode):
|
||||
"""
|
||||
智能工厂组装单处扫码绑定刀具物料
|
||||
|
||||
@@ -136,6 +136,7 @@ access_sf_shelf_location_wizard_group_plan_dispatch,sf_shelf_location_wizard_gro
|
||||
access_sf_shelf_location_wizard_group_sf_stock_user_group_sf_stock_user,sf_shelf_location_wizard_group_sf_stock_user_group_sf_stock_user,model_sf_shelf_location_wizard,sf_warehouse.group_sf_stock_user,1,0,0,0
|
||||
access_sf_shelf_location_wizard_group_sf_stock_manager,sf_shelf_location_wizard_group_sf_stock_manager,model_sf_shelf_location_wizard,sf_warehouse.group_sf_stock_manager,1,1,1,0
|
||||
|
||||
access_sf_shelf_location_group_sf_tool_user,sf.shelf.location.group_sf_tool_user,model_sf_shelf_location,sf_base.group_sf_tool_user,1,1,0,0
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -246,6 +246,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<search string="货位">
|
||||
<field name="barcode"/>
|
||||
<field name="product_id"/>
|
||||
<searchpanel class="account_root">
|
||||
<!-- <field name="location_type" icon="fa-filter"/> -->
|
||||
<!-- <field name="location_id" select="multi" icon="fa-filter"/> -->
|
||||
|
||||
Reference in New Issue
Block a user