1、功能刀具拆解单拆解流程优化;2、优化货位看板显示;

This commit is contained in:
yuxianghui
2024-06-04 11:26:00 +08:00
parent 67c4f64d08
commit 3882d3a3cb
4 changed files with 57 additions and 57 deletions

View File

@@ -847,43 +847,48 @@ class FunctionalToolDismantle(models.Model):
if self.dismantle_cause in ['寿命到期报废', '崩刀报废']:
# 除刀柄外物料报废 入库到Scrap
if self.integral_product_id:
self.integral_product_id.dismantle_stock_moves(False, location, location_dest_scrap)
self.integral_product_id.dismantle_stock_moves(False, self.integral_lot_id, location,
location_dest_scrap)
elif self.blade_product_id:
self.blade_product_id.dismantle_stock_moves(False, location, location_dest_scrap)
self.blade_product_id.dismantle_stock_moves(False, self.blade_lot_id, location, location_dest_scrap)
if self.bar_product_id:
self.bar_product_id.dismantle_stock_moves(False, location, location_dest_scrap)
self.bar_product_id.dismantle_stock_moves(False, self.bar_lot_id, location, location_dest_scrap)
elif self.pad_product_id:
self.pad_product_id.dismantle_stock_moves(False, location, location_dest_scrap)
self.pad_product_id.dismantle_stock_moves(False, self.pad_lot_id, location, location_dest_scrap)
if self.chuck_product_id:
self.chuck_product_id.dismantle_stock_moves(False, location, location_dest_scrap)
self.chuck_product_id.dismantle_stock_moves(False, self.chuck_lot_id, location, location_dest_scrap)
# ===========功能刀具[磨削]拆解==============
elif self.dismantle_cause in ['刀具需磨削']:
location_dest = self.env['stock.location'].search([('name', '=', '磨削房')])
# 除刀柄外物料拆解 入库到具体库位
if self.integral_product_id:
self.integral_product_id.dismantle_stock_moves(False, location, location_dest)
elif self.blade_product_id:
self.blade_product_id.dismantle_stock_moves(False, location, location_dest)
if self.bar_product_id:
self.bar_product_id.dismantle_stock_moves(False, location, location_dest)
elif self.pad_product_id:
self.pad_product_id.dismantle_stock_moves(False, location, location_dest)
if self.chuck_product_id:
self.chuck_product_id.dismantle_stock_moves(False, location, location_dest)
# ==============功能刀具[更换]拆解==============
elif self.dismantle_cause in ['更换为其他刀具']:
# 除刀柄外物料拆解 入库到具体
# elif self.dismantle_cause in ['刀具需磨削']:
# location_dest = self.env['stock.location'].search([('name', '=', '磨削房')])
# # 除刀柄外物料拆解 入库到具体库位
# if self.integral_product_id:
# self.integral_product_id.dismantle_stock_moves(False, location, location_dest)
# elif self.blade_product_id:
# self.blade_product_id.dismantle_stock_moves(False, location, location_dest)
# if self.bar_product_id:
# self.bar_product_id.dismantle_stock_moves(False, location, location_dest)
# elif self.pad_product_id:
# self.pad_product_id.dismantle_stock_moves(False, location, location_dest)
# 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:
self.integral_product_id.dismantle_stock_moves(self.integral_freight_id.barcode, location,
self.integral_product_id.dismantle_stock_moves(self.integral_freight_id, self.integral_lot_id, location,
location_dest)
elif self.blade_freight_id:
self.blade_product_id.dismantle_stock_moves(self.blade_freight_id.barcode, location, location_dest)
self.blade_product_id.dismantle_stock_moves(self.blade_freight_id, self.blade_lot_id, location,
location_dest)
if self.bar_freight_id:
self.bar_product_id.dismantle_stock_moves(self.bar_freight_id.barcode, location, location_dest)
self.bar_product_id.dismantle_stock_moves(self.bar_freight_id, self.bar_lot_id, location,
location_dest)
elif self.pad_freight_id:
self.pad_product_id.dismantle_stock_moves(self.pad_freight_id.barcode, location, location_dest)
self.pad_product_id.dismantle_stock_moves(self.pad_freight_id, self.pad_lot_id, location,
location_dest)
if self.chuck_freight_id:
self.chuck_product_id.dismantle_stock_moves(self.chuck_freight_id.barcode, location, location_dest)
self.chuck_product_id.dismantle_stock_moves(self.chuck_freight_id, self.chuck_lot_id, location,
location_dest)
# ===============删除功能刀具的Rfid字段的值 赋值给Rfid(已拆解)字段=====
self.functional_tool_id.write({
'rfid_dismantle': self.functional_tool_id.rfid,
@@ -904,7 +909,7 @@ class FunctionalToolDismantle(models.Model):
class ProductProduct(models.Model):
_inherit = 'product.product'
def dismantle_stock_moves(self, shelf_location_barcode, location_id, location_dest_id):
def dismantle_stock_moves(self, shelf_location_id, lot_id, location_id, location_dest_id):
# 创建功能刀具拆解单产品库存移动记录
stock_move_id = self.env['stock.move'].sudo().create({
'name': '功能刀具拆解',
@@ -914,16 +919,12 @@ class ProductProduct(models.Model):
'product_uom_qty': 1.00,
'state': 'done'
})
if shelf_location_barcode:
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', shelf_location_barcode)])
location.product_num = location.product_num + 1
else:
location = self.env['sf.shelf.location']
# 创建移动历史记录
stock_move_line_id = self.env['stock.move.line'].sudo().create({
'product_id': self.id,
'lot_id': lot_id.id,
'move_id': stock_move_id.id,
'current_location_id': location.id,
'destination_location_id': shelf_location_id.id,
'install_tool_time': fields.Datetime.now(),
'qty_done': 1.0,
'state': 'done',