仓库管理系统python
时间: 2023-08-17 07:11:25 浏览: 45
仓库管理系统是用来管理仓库内物品的系统。在Python中,可以使用各种库和框架来开发这样的系统。以下是一个简单的示例:
```python
class Item:
def __init__(self, name, quantity):
self.name = name
self.quantity = quantity
class Warehouse:
def __init__(self):
self.inventory = []
def add_item(self, item):
self.inventory.append(item)
def remove_item(self, item):
self.inventory.remove(item)
def search_item(self, name):
for item in self.inventory:
if item.name == name:
return item
return None
# 示例用法
warehouse = Warehouse()
item1 = Item("Item 1", 10)
item2 = Item("Item 2", 5)
warehouse.add_item(item1)
warehouse.add_item(item2)
found_item = warehouse.search_item("Item 1")
if found_item:
print(f"Found item: {found_item.name}, quantity: {found_item.quantity}")
else:
print("Item not found")
```
以上代码展示了一个简单的仓库管理系统,其中包含了物品的添加、删除和搜索功能。你可以根据自己的需求进行扩展和修改。希望能对你有所帮助!