添加功能刀具组装时扫描录入刀具物料时进行物料是否已入库和是否已经使用的判断

This commit is contained in:
yuxianghui
2024-02-01 17:07:19 +08:00
parent 3cb71a8017
commit 8e806225d0

View File

@@ -304,6 +304,10 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
if not records:
raise ValidationError('扫描的条形码数据不存在,请重新扫描!')
for record_stock_lot in records:
if record_stock_lot.quant_ids[-1].location_id.name == '刀具组装位置':
raise ValidationError('该刀具物料已使用,请重新选择!!!')
elif record_stock_lot.quant_ids[-1].location_id.name not in '刀具房':
raise ValidationError('该刀具物料未入库,请重新选择!!!')
tool_material_name = record_stock_lot.product_id.cutting_tool_material_id.name
if tool_material_name == '整体式刀具':
record.integral_code_id = record_stock_lot.id