1、优化功能刀具拆解单拆解原因为更换其他刀具时的扫码录入刀具物料货位信息功能;2、优化功能刀具拆解单确认拆解后的刀具物料拆解流程,及其刀具物料功能刀具的数量统计等;3、功能刀具拆解、功能刀具模块添加动作过滤已拆解状态的记录,并添加筛选方法;4、功能刀具组装流程添加刀具物料货位数量校验;

This commit is contained in:
yuxianghui
2024-04-23 14:15:45 +08:00
parent 080a3d7175
commit 8bc23f5136
8 changed files with 114 additions and 60 deletions

View File

@@ -403,7 +403,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
after_name_id = fields.Many2one('sf.tool.inventory', string='功能刀具名称', required=True)
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号')
rfid = fields.Char('Rfid', compute='_compute_rfid')
tool_code = fields.Char(string='功能刀具编码', compute='_compute_tool_code')
code = fields.Char(string='功能刀具编码', compute='_compute_code')
after_assembly_functional_tool_name = fields.Char(string='组装后功能刀具名称', compute='_compute_name', store=True)
after_assembly_functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model',
string='组装后功能刀具类型')
@@ -448,7 +448,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
@api.depends('after_assembly_functional_tool_type_id', 'integral_specification_id', 'bar_specification_id',
'pad_specification_id', 'handle_specification_id', 'after_assembly_tool_loading_length')
def _compute_tool_code(self):
def _compute_code(self):
for obj in self:
str_1 = 'GNDJ-%s' % obj.after_assembly_functional_tool_type_id.code
str_2 = ''
@@ -467,11 +467,11 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
obj.pad_specification_id.cut_depth_max, obj.handle_specification_id.total_length,
)
else:
obj.tool_code = str_2
obj.code = str_2
return True
obj.tool_code = str_2 + str(self._get_code(str_2))
obj.code = str_2 + str(self._get_code(str_2))
else:
obj.tool_code = str_2
obj.code = str_2
def _get_code(self, str_2):
functional_tool_assembly = self.env['sf.functional.cutting.tool.entity'].sudo().search(
@@ -618,7 +618,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
def get_desc_1(self, stock_lot):
return {
'barcode_id': stock_lot.id,
'code': self.tool_code,
'code': self.code,
'rfid': self.rfid,
'tool_groups_id': self.after_tool_groups_id.id,
'integral_freight_barcode': self.integral_freight_barcode,
@@ -655,7 +655,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
def get_desc_2(self, stock_lot, functional_tool_assembly_id):
return {
'barcode_id': stock_lot.id,
'code': self.tool_code,
'code': self.code,
'name': self.after_name_id.name,
'tool_name_id': self.after_name_id.id,
'rfid': self.rfid,
@@ -718,7 +718,7 @@ class StockPicking(models.Model):
'functional_tool_type_id': obj.functional_tool_type_id.id,
'diameter': obj.after_assembly_functional_tool_diameter,
'knife_tip_r_angle': obj.after_assembly_knife_tip_r_angle,
'code': obj.tool_code,
'code': obj.code,
'rfid': obj.rfid,
'functional_tool_name': obj.after_assembly_functional_tool_name,
'tool_groups_id': obj.after_tool_groups_id.id
@@ -762,7 +762,7 @@ class ProductProduct(models.Model):
stock_location_id = self.env['stock.location'].search([('name', '=', '组装后')])
# 创建功能刀具该批次/序列号 库存移动和移动历史
stock_lot.create_stock_quant(location_inventory_id, stock_location_id, functional_tool_assembly.id,
'功能刀具组装', obj)
'功能刀具组装', obj, obj.after_tool_groups_id)
return stock_lot
@@ -796,7 +796,7 @@ class ProductProduct(models.Model):
location_inventory_id = tool_material.quant_ids.location_id[-1]
stock_location_id = self.env['stock.location'].search([('name', '=', '刀具组装位置')])
# 创建功能刀具该批次/序列号 库存移动和移动历史
tool_material.create_stock_quant(location_inventory_id, stock_location_id, None, '功能刀具组装', False)
tool_material.create_stock_quant(location_inventory_id, stock_location_id, None, '功能刀具组装', False, False)
def material_stock_moves(self, shelf_location_barcode):
# 创建库存移动记录
@@ -819,16 +819,19 @@ class ProductProduct(models.Model):
'qty_done': 1.0,
'state': 'done',
})
location.product_num = location.product_num - 1
if location.product_num > 0:
location.product_num = location.product_num - 1
else:
raise ValidationError(
'%s】货位的【%s】产品库存数量为零,请采购入库后再重新组装!' % (location.barcode, location.product_id.name))
return stock_move_id, stock_move_line_id
class StockLot(models.Model):
_inherit = 'stock.lot'
def create_stock_quant(self, location_inventory_id, stock_location_id, functional_tool_assembly_id, name, obj):
def create_stock_quant(self, location_inventory_id, stock_location_id, functional_tool_assembly_id, name, obj,
tool_groups_id):
"""
对功能刀具组装过程的功能刀具和刀具物料进行库存移动,以及创建移动历史
"""
@@ -855,10 +858,10 @@ class StockLot(models.Model):
'functional_tool_type_id': False if not obj else obj.functional_tool_type_id.id,
'diameter': None if not obj else obj.after_assembly_functional_tool_diameter,
'knife_tip_r_angle': None if not obj else obj.after_assembly_knife_tip_r_angle,
'code': '' if not obj else obj.tool_code,
'code': '' if not obj else obj.code,
'rfid': '' if not obj else obj.rfid,
'functional_tool_name': '' if not obj else obj.after_assembly_functional_tool_name,
'tool_groups_id': False if not obj else obj.after_tool_groups_id.id
'tool_groups_id': False if not tool_groups_id else tool_groups_id.id
})
return stock_move_id, stock_move_line_id

View File

@@ -334,7 +334,7 @@
<group>
<group>
<field name="barcode_id" invisible="True"/>
<field name="tool_code" readonly="True"/>
<field name="code" readonly="True"/>
<field name="rfid" class="custom_required"/>
<field name="after_name_id" string="功能刀具名称" placeholder="请选择功能刀具名称"
options="{'no_create': True, 'no_quick_create': True}"/>