一、系统需求分析 1.辣度分级标准建立 -参考国际斯科维尔辣度指数(SHU)或建立本土化分级体系 -典型分级:微辣(1-10万SHU)、中辣(10-50万SHU)、重辣(50-100万SHU)、变态辣(100万+SHU) -结合川菜特色:麻度分级(低/中/高) 2.核心功能
一、系统需求分析
1. 辣度分级标准建立
- 参考国际斯科维尔辣度指数(SHU)或建立本土化分级体系
- 典型分级:微辣(1-10万SHU)、中辣(10-50万SHU)、重辣(50-100万SHU)、变态辣(100万+SHU)
- 结合川菜特色:麻度分级(低/中/高)
2. 核心功能需求
- 产品辣度信息管理
- 辣度与原料关联管理
- 生产过程辣度控制
- 消费者查询与反馈
- 数据分析与报告
二、系统架构设计
1. 数据库设计
```sql
CREATE TABLE products (
product_id INT PRIMARY KEY,
name VARCHAR(100),
base_spiciness_level INT, -- 基础辣度等级(1-5)
max_spiciness_level INT, -- 最大可调辣度
description TEXT
);
CREATE TABLE spiciness_levels (
level_id INT PRIMARY KEY,
level_name VARCHAR(20), -- 微辣/中辣/重辣等
shu_min INT, -- 斯科维尔指数下限
shu_max INT, -- 斯科维尔指数上限
color_code VARCHAR(7) -- 显示颜色代码
);
CREATE TABLE ingredients (
ingredient_id INT PRIMARY KEY,
name VARCHAR(50),
spiciness_contribution DECIMAL(5,2), -- 对辣度的贡献值
max_usage_rate DECIMAL(5,2) -- 最大使用比例
);
CREATE TABLE production_records (
record_id INT PRIMARY KEY,
product_id INT,
batch_no VARCHAR(30),
actual_spiciness DECIMAL(8,2), -- 实际测量的辣度值
production_date DATE,
FOREIGN KEY (product_id) REFERENCES products(product_id)
);
```
2. 系统模块划分
- 基础数据管理模块:辣度分级标准、原料库、产品库
- 生产管理模块:配方管理、生产过程控制
- 质量管理模块:辣度检测、质量追溯
- 销售管理模块:产品展示、消费者反馈
- 数据分析模块:辣度偏好分析、销售预测
三、辣度分级管理实现
1. 辣度计算算法
```python
def calculate_spiciness(product_id, ingredient_quantities):
"""
计算产品实际辣度值
:param product_id: 产品ID
:param ingredient_quantities: 原料用量字典 {原料ID: 用量(kg)}
:return: 斯科维尔指数值
"""
获取产品基础信息
product = get_product_info(product_id)
total_spiciness = 0
total_weight = sum(ingredient_quantities.values())
for ingredient_id, quantity in ingredient_quantities.items():
ingredient = get_ingredient_info(ingredient_id)
辣度贡献 = (原料辣度贡献值 * 用量) / 总重量
contribution = (ingredient[spiciness_contribution] * quantity) / total_weight
total_spiciness += contribution
考虑基础辣度等级的加成
base_factor = get_base_factor(product[base_spiciness_level])
final_spiciness = total_spiciness * base_factor
return round(final_spiciness, 2)
```
2. 辣度分级显示实现
```javascript
// 前端显示逻辑
function displaySpicinessLevel(shuValue) {
const levels = [
{ min: 0, max: 10000, name: 微辣, color: FFD700 },
{ min: 10000, max: 50000, name: 中辣, color: FF8C00 },
{ min: 50000, max: 100000, name: 重辣, color: FF4500 },
{ min: 100000, max: Infinity, name: 变态辣, color: 8B0000 }
];
let level = levels.find(l => shuValue >= l.min && shuValue <= l.max);
return `
${level.name}
(${Math.round(shuValue)} SHU)
`;
}
```
3. 生产过程控制实现
```python
class SpicinessController:
def __init__(self, product_id):
self.product = self._get_product_info(product_id)
self.target_spiciness = self._calculate_target_spiciness()
def _calculate_target_spiciness(self):
根据产品规格和客户要求计算目标辣度
base = self.product[base_spiciness_level]
可以添加客户定制参数等逻辑
return self._get_standard_spiciness(base)
def adjust_ingredients(self, current_quantities):
"""
根据当前原料用量调整以达到目标辣度
"""
current_spiciness = calculate_spiciness(self.product[id], current_quantities)
difference = self.target_spiciness - current_spiciness
if abs(difference) < 500: 允许误差范围
return current_quantities
调整主要辣味原料(如辣椒、花椒)
for ingredient_id in self._get_spicy_ingredients():
if difference > 0: 需要增加辣度
current_quantities[ingredient_id] *= 1.05 增加5%
else: 需要降低辣度
current_quantities[ingredient_id] *= 0.95 减少5%
return self.adjust_ingredients(current_quantities) 递归调整直到满足要求
```
四、系统扩展功能
1. 消费者定制化
- 允许消费者选择辣度等级(1-10级)
- 系统自动计算所需原料比例
- 生成定制化生产指令
2. 辣度追溯系统
- 记录每批产品的实际辣度检测值
- 关联原料批次信息
- 实现从原料到成品的完整追溯
3. 区域化辣度适配
- 根据不同地区消费者的辣度偏好
- 自动调整产品基础辣度配置
- 提供区域化销售策略支持
4. 移动端应用
- 消费者扫码查询产品辣度信息
- 辣度偏好调查与反馈
- 辣度知识科普功能
五、实施建议
1. 分阶段实施
- 第一期:实现基础辣度分级管理和生产控制
- 第二期:增加消费者互动和数据分析功能
- 第三期:完善定制化和追溯系统
2. 硬件集成
- 考虑与辣度检测设备(如斯科维尔测量仪)集成
- 实现生产数据自动采集
3. 培训计划
- 对生产人员进行辣度控制培训
- 对质检人员进行辣度检测培训
- 对销售人员进行辣度知识培训
4. 持续优化
- 收集消费者反馈数据
- 定期调整辣度分级标准
- 优化辣度计算算法
通过此系统的实施,川味冻品企业可以实现辣度的精准管理,提高产品质量一致性,满足不同消费者的需求,增强市场竞争力。