{"id":29041958,"url":"https://github.com/beyondesh/inventory-management-system","last_synced_at":"2026-05-15T23:05:04.279Z","repository":{"id":299178676,"uuid":"1002280364","full_name":"BeyondESH/Inventory-Management-System","owner":"BeyondESH","description":"一个基于Python Tkinter的工厂后台综合管理系统","archived":false,"fork":false,"pushed_at":"2025-06-22T13:05:44.000Z","size":66028,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-22T14:19:25.041Z","etag":null,"topics":["mysql","pyhton","sql","tkinter","tkinter-gui"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BeyondESH.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-15T05:41:09.000Z","updated_at":"2025-06-22T13:02:24.000Z","dependencies_parsed_at":"2025-06-15T06:42:25.546Z","dependency_job_id":null,"html_url":"https://github.com/BeyondESH/Inventory-Management-System","commit_stats":null,"previous_names":["beyondesh/inventory-management-system"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BeyondESH/Inventory-Management-System","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeyondESH%2FInventory-Management-System","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeyondESH%2FInventory-Management-System/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeyondESH%2FInventory-Management-System/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeyondESH%2FInventory-Management-System/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BeyondESH","download_url":"https://codeload.github.com/BeyondESH/Inventory-Management-System/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeyondESH%2FInventory-Management-System/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265746409,"owners_count":23821645,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mysql","pyhton","sql","tkinter","tkinter-gui"],"created_at":"2025-06-26T15:06:18.617Z","updated_at":"2026-05-15T23:04:59.240Z","avatar_url":"https://github.com/BeyondESH.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 工厂后台综合管理系统\n\n一个基于Python Tkinter的食品工厂后台综合管理系统，包含用户登录注册、库存管理、餐食配置、订单管理、客户信息管理和财务管理等功能模块。\n\n## 项目结构\n\n```\nInventory-Management-System/\n├── main.py                 # 主启动文件\n├── requirements.txt        # 项目依赖\n├── README.md              # 项目说明\n├── src/                   # 源代码目录\n│   ├── system_launcher.py  # 系统启动器\n│   ├── login_module.py     # 登录注册模块\n│   ├── user_manager.py     # 用户管理类\n│   ├── inventory_system.py # 主系统界面\n│   ├── inventory_module.py # 库存管理模块\n│   ├── meal_module.py      # 餐食配置模块\n│   ├── order_module.py     # 订单管理模块\n│   ├── customer_module.py  # 客户信息管理模块\n│   └── finance_module.py   # 财务管理模块\n├── data/                  # 数据文件目录\n│   └── users.json         # 用户数据\n├── config/                # 配置文件目录\n│   └── settings.json      # 系统配置\n├── docs/                  # 文档目录\n│   ├── README.md          # 详细文档\n│   ├── MODULE_ARCHITECTURE.md # 模块架构说明\n│   ├── MANAGEMENT_SYSTEM_README.md # 管理系统说明\n│   └── QUICK_START.md     # 快速开始指南\n└── image/                 # 图片资源目录\n    ├── icon/              # 图标文件\n    ├── png/               # PNG图片\n    └── svg/               # SVG图片\n```\n\n## 快速开始\n\n### 1. 环境要求\n- Python 3.6+\n- Tkinter\n\n### 2. 运行系统\n从项目根目录运行：\n```bash\npython main.py\n```\n\n或者从src目录运行：\n```bash\ncd src\npython system_launcher.py\n```\n\n### 3. 登录系统\n- 使用默认管理员账户：admin / admin@company.com\n- 或者注册新用户\n- 支持游客模式快速体验\n\n## 功能模块\n\n### 用户系统\n- 用户注册登录\n- 密码重置\n- 游客模式\n- 用户信息管理\n\n### 业务模块\n1. **库存管理** - 商品库存的增删改查\n2. **餐食配置** - 餐食菜单和配置管理\n3. **订单管理** - 订单创建、处理和跟踪\n4. **客户信息管理** - 客户资料维护\n5. **财务管理** - 财务数据统计和分析\n\n## 开发说明\n\n项目采用模块化设计，每个业务功能都是独立的类和文件，便于维护和扩展。\n\n- `src/` - 所有Python源代码\n- `data/` - 数据存储文件\n- `config/` - 配置文件\n- `docs/` - 项目文档\n- `image/` - 界面图标和图片资源\n\n## 许可证\n\nMIT License\n\n\n## 项目详细说明\n### 一、项目背景与目标\n\n本项目旨在为一家小型家族经营的食品服务公司开发一套完整的软件系统，提供库存管理、订单追踪、财务预算与客户管理等功能，全面提升其运营效率。采用 Tkinter + MySQL技术栈构建。\n\n### 二、业务需求说明\n\n#### 1. 库存管理\n\n- 管理食材与配送容器的库存数据，包括名称、当前库存、单位、有效期。\n- 自动根据客户订单减少相关库存数量。\n- 设置安全库存阈值，低于阈值则提示补货。\n\n#### 2. 餐食配置\n\n- 支持自定义至少 5 种可售餐食（Meal），每种餐食需包含所需食材和容器组成。\n- 每个餐食价格可设置，且可用于成本核算。\n\n#### 3. 订单管理\n\n- 记录客户订单信息：下单时间、配送时间、订单状态（已接收/进行中/完成）。\n- 管理订单明细（每种餐食数量、价格），并生成订单统计。\n\n#### 4. 客户信息管理\n\n- 存储客户姓名、联系方式、地址与支付方式。\n- 查询客户历史订单。\n\n#### 5. 财务管理\n\n- 跟踪订单收入与食材/容器成本。\n- 固定成本：人力（\\$10,000/月）、租金（\\$3,500/月）、水电（\\$2,000/月）、杂费（\\$1,000/月）。\n- 支持生成月度利润报表。\n\n### 三、系统架构图\n\n```mermaid\ngraph TD\n  subgraph UI_Tkinter [前端UI: Tkinter]\n    Login[登录界面]\n    MealUI[餐食管理]\n    IngredientUI[原料管理]\n    CustomerUI[客户管理]\n    OrderUI[订单处理]\n    ReportUI[报表财务]\n  end\n\n  subgraph Backend_Python [后端: Python + PyMySQL]\n    API[后端API服务]\n  end\n\n  subgraph Database_MySQL [数据库: MySQL]\n    Customer[(Customer)]\n    PaymentMethod[(Payment_method)]\n    Meal[(Meal)]\n    MealContainer[(Meal_container)]\n    Container[(Container)]\n    ContainerBatch[(Container_batch)]\n    ContainerSupplier[(Container_supplier)]\n    ContainerBatchPrice[(Container_batch_price)]\n    Ingredient[(Ingredient)]\n    IngredientBatch[(Ingredient_batch)]\n    IngredientSupplier[(Ingredient_supplier)]\n    IngredientBatchPrice[(Ingredient_batch_price)]\n    Employee[(Employee)]\n    EmployeeSalary[(Employee_salary)]\n    Orders[(Order)]\n    OrderPrice[(Order_price)]\n    FixedCost[(Fixed_cost)]\n    TotalIncome[(Total_income)]\n  end\n\n  Login --\u003e API\n  MealUI --\u003e API\n  IngredientUI --\u003e API\n  CustomerUI --\u003e API\n  OrderUI --\u003e API\n  ReportUI --\u003e API\n\n  API --\u003e Customer\n  API --\u003e PaymentMethod\n  API --\u003e Meal\n  API --\u003e MealContainer\n  API --\u003e Container\n  API --\u003e ContainerBatch\n  API --\u003e ContainerSupplier\n  API --\u003e ContainerBatchPrice\n  API --\u003e Ingredient\n  API --\u003e IngredientBatch\n  API --\u003e IngredientSupplier\n  API --\u003e IngredientBatchPrice\n  API --\u003e Employee\n  API --\u003e EmployeeSalary\n  API --\u003e Orders\n  API --\u003e OrderPrice\n  API --\u003e FixedCost\n  API --\u003e TotalIncome\n```\n\n### 四、数据库表结构设计（含主键PK与外键FK标注）\n\n#### Customer 与支付方式\n\n- **Customer**(\n  - `PK` customer_id,\n  - first_name, last_name, customer_phone, customer_email, customer_address,\n  - `FK` payment_method_id)\n- **Payment_method**(`PK` payment_method_id, method_name)\n\n#### 餐品与容器\n\n- **Meal**(`PK` meal_id, meal_name, meal_details, meal_price, isActive)\n- **Meal_container**(\n  - `PK` meal_id + container_id（联合主键）,\n  - `FK` meal_id, `FK` container_id,\n  - container_required_quantity)\n- **Container**(`PK` container_id, container_type, container_unit_cost, container_current_stock, container_reorder_threshold)\n- **Container_batch**(\n  - `PK` container_batch_id,\n  - `FK` container_id, `FK` container_supplier_id, `FK` container_batch_price_id,\n  - container_batch_purchase_date)\n- **Container_supplier**(`PK` container_supplier_id, container_supplier_name, container_supplier_contact_email, container_supplier_phone, container_supplier_address)\n- **Container_batch_price**(`PK` container_batch_price_id, container_batch_price)\n\n#### 员工与薪资\n\n- **Employee**(`PK` employee_id, employee_name, employee_address, `FK` employee_salary_id)\n- **Employee_salary**(`PK` employee_salary_id, employee_salary_amount, pay_day)\n\n#### 原料与供货商\n\n- **Ingredient**(`PK` ingredient_id, ingredient_name, ingredient_current_stock, unit_measure, ingredient_reorder_threshold, ingredient_unit_cost)\n- **Ingredient_batch**(\n  - `PK` ingredient_batch_id,\n  - `FK` ingredient_id, `FK` ingredient_batch_price_id, `FK` ingredient_supplier_id,\n  - expiration_date, ingredient_purchase_date)\n- **Ingredient_supplier**(`PK` ingredient_supplier_id, ingredient_supplier_name, ingredient_supplier_email, ingredient_supplier_phone, ingredient_supplier_address)\n- **Ingredient_batch_price**(`PK` ingredient_batch_price_id, ingredient_batch_price)\n\n#### 订单与定价\n\n- **Order**(\n  - `PK` order_id,\n  - `FK` meal_id, `FK` customer_id, `FK` employee_id, `FK` order_price_id, `FK` payment_method_id,\n  - order_date, delivery_date, order_status, order_note)\n- **Order_price**(`PK` order_price_id, order_price)\n\n#### 财务与收入\n\n- **Fixed_cost**(`PK` fixed_cost_id, cost_type, effective_date, cost_amount)\n- **Total_income**(\n  - `PK` total_income_id,\n  - `FK` order_price_id, `FK` employee_salary_id, `FK` container_batch_price_id, `FK` ingredient_batch_price_id, `FK` fixed_cost_id)\n\n### 五、前端模块说明（基于 Tkinter）\n\n本系统前端使用 `Tkinter` 实现图形化界面，整体采用**面向对象编程思想**（OOP）。每个模块封装为一个独立类，位于单独的 `.py` 文件中，通过主程序进行模块化引用。所有 UI 设计遵循“**简约、美观、用户友好**”的设计理念，保持统一风格，适配中小企业的使用场景。\n\n#### 项目结构建议\n\n```\nfrontend/\n├── main.py                # 应用入口，启动主窗口\n├── login.py               # 登录注册模块类 LoginUI\n├── menu.py                # 主菜单模块类 MainMenuUI\n├── meal.py                # 餐食管理模块类 MealUI\n├── ingredient.py          # 原料管理模块类 IngredientUI\n├── container.py           # 容器管理模块类 ContainerUI\n├── order.py               # 订单处理模块类 OrderUI\n├── customer.py            # 客户管理模块类 CustomerUI\n├── employee.py            # 员工管理模块类 EmployeeUI\n├── report.py              # 报表与财务模块类 ReportUI\n└── utils.py               # 通用工具类（如数据库连接、弹窗提示等）\n```\n\n\u003e 所有类遵循封装原则，公开访问使用 getter / setter 方法，并按模块组织成员属性与行为逻辑。\n\n前端系统将以模块化方式组织，采用 `Tkinter` 实现多窗口界面切换与控件交互。每个模块以独立类或窗口呈现，具备以下详细功能与布局建议：\n\n前端基于 Tkinter 实现桌面图形化界面，模块划分明确，功能覆盖库存、订单、客户与财务管理。\n\n#### 1. 登录注册模块（Login / Register）\n\n- **注册功能：**\n  - 用户输入姓名、邮箱、电话、密码进行注册。\n  - 邮箱需唯一，注册后写入 Customer 表，自动分配 customer_id。\n  - 默认支付方式可为空，注册后可由管理员或客户自行添加。\n- **登录功能：**\n  - 用户通过邮箱 + 密码进行身份验证。\n  - 登录后加载对应客户信息并进入主界面。\n  - 密码输入框加密显示，登录失败给予明确反馈。\n- **登录后跳转：**\n  - 普通客户登录后进入订单创建界面。\n  - 管理员或员工账户进入管理主界面。\n- **安全性建议：**\n  - 使用哈希加密存储密码。\n  - 注册流程中校验邮箱格式与重复性。\n\n#### 2. 主菜单模块（Main Menu）\n\n- 提供导航按钮进入各业务模块：餐食管理、库存管理、订单管理、客户管理、报表分析。\n- 显示系统版本信息与用户欢迎语。\n\n#### 3. 餐食管理模块（MealUI）\n\n- 界面布局：\n  - 左侧列表：显示当前所有餐食（meal_id + meal_name）。\n  - 中间区域：展示并编辑所选餐食详情（名称、描述、价格、状态）。\n  - 下方按钮：新增、保存、删除、配置原料与容器。\n- 功能操作：\n  - 添加新餐食（支持空白模板填充）。\n  - 餐食激活/停用控制（isActive 字段）。\n  - 餐食配置窗口：弹出新窗口管理 meal_container 关系，选择容器与需求数量。\n  - 自动计算配料总成本与建议售价。\n  - 验证重复名称、非法价格等。\n- 新增餐食：录入名称、描述、价格、状态。\n- 配置餐食组成：选择食材与容器及其数量。\n- 编辑/删除餐食信息。\n- 查看餐食成本（根据组成计算）。\n\n#### 4. 原料管理模块（IngredientUI）\n\n- 界面布局：\n  - 左侧：原料列表（可筛选/搜索）。\n  - 右侧：详细信息区域（包括当前库存、安全库存、单位价格、单位）。\n  - 下方分页：跳转至批次管理页。\n- 功能操作：\n  - 添加新原料。\n  - 编辑/删除原料属性。\n  - 低库存/过期预警图标提示。\n  - 查看/录入 Ingredient_batch（采购批次、价格、供应商、有效期）。\n  - 自动计算当前总库存与加权平均成本。\n- 新增食材信息：名称、单位、初始库存、安全库存、单价。\n- 批次管理：添加/查看采购批次与有效期。\n- 更新库存：增加/减少库存量。\n- 提示即将过期食材。\n\n#### 5. 容器管理子模块\n\n- 添加容器类型、单位成本、安全库存。\n- 记录容器采购批次。\n- 显示容器当前库存与供应商信息。\n\n#### 6. 订单处理模块（OrderUI）\n\n- 界面布局：\n  - 客户选择下拉框（自动读取 customer 表）。\n  - 员工选择（默认当前操作人）。\n  - 配送日期输入框（支持日历选择）。\n  - 餐品选择区：多选列表添加每个 Meal 与数量。\n  - 订单详情表格：展示当前订单内容。\n  - 底部按钮：保存订单 / 修改状态 / 删除订单。\n- 功能操作：\n  - 新建订单写入 order 与 order_price 表。\n  - 提交订单后自动调用库存接口扣减食材/容器。\n  - 订单状态支持切换三种状态，带颜色标签。\n  - 查看单个订单的完整履历记录。\n- 新建订单：选择客户、员工、配送日期，添加所选餐食及数量。\n- 订单状态更新：从“已接收”到“进行中”再到“已完成”。\n- 显示订单详情，包括餐食明细与总价。\n- 自动关联支付方式并更新库存。\n\n#### 7. 客户管理模块（CustomerUI）\n\n- 新增客户信息：姓名、邮箱、电话、地址、支付方式。\n- 编辑客户资料。\n- 查询客户历史订单列表与详情。\n\n#### 8. 员工管理子模块（可扩展）\n\n- 录入员工信息与月薪。\n- 显示员工参与的订单履历。\n\n#### 9. 报表与财务模块（ReportUI）\n\n- 收入汇总：按月展示订单收入与客户贡献。\n- 成本明细：显示容器/食材采购、员工工资、固定费用。\n- 利润分析：计算净收入 = 收入 - 成本。\n- 导出报表（CSV/Excel）。\n\n#### 10. 通用功能\n\n- 弹窗提示与错误处理。\n- 所有表单输入校验。\n- 所有数据可通过界面刷新与查询。\n- 简洁直观 UI 设计，适配小团队使用。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeyondesh%2Finventory-management-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeyondesh%2Finventory-management-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeyondesh%2Finventory-management-system/lists"}