工厂与生产管理
High Contrast
Dark Mode
Light Mode
Sepia
Forest
1 min read271 words

工厂与生产管理

制造是供应链的核心引擎——把原材料变成客户想要的产品。

生产管理架构

graph TD DEMAND[需求计划] --> MPS[主生产计划 MPS] MPS --> MRP[物料需求计划 MRP] MRP --> PURCHASE[采购] MRP --> PRODUCTION[生产排程] PRODUCTION --> SHOP[车间执行] SHOP --> QC[质量检验] QC --> FG[成品入库] SHOP --> MES[MES 制造执行] MES --> MONITOR[实时监控] style MPS fill:#e3f2fd,stroke:#1565c0,stroke-width:2px style MES fill:#c8e6c9,stroke:#388e3c,stroke-width:2px

MRP 物料需求计划

"""
MRP 物料需求计划
"""
from dataclasses import dataclass, field
@dataclass
class BOMItem:
"""BOM 物料清单条目"""
material: str
quantity_per: float  # 每单位成品需要量
lead_time_days: int
on_hand: int = 0
on_order: int = 0
@dataclass
class ProductionOrder:
product: str
quantity: int
due_date: str
class MRPCalculator:
"""MRP 计算器"""
def __init__(self, bom: list[BOMItem]):
self.bom = {item.material: item for item in bom}
def calculate(
self, order: ProductionOrder
) -> list[dict]:
"""计算物料需求"""
results = []
for name, item in self.bom.items():
gross = order.quantity * item.quantity_per
net = gross - item.on_hand - item.on_order
net = max(0, net)
results.append({
"物料": name,
"毛需求": f"{gross:.0f}",
"现有库存": item.on_hand,
"在途": item.on_order,
"净需求": f"{net:.0f}",
"需下单": "是" if net > 0 else "否",
"提前期": f"{item.lead_time_days} 天",
})
return results
# 演示 — 生产1000台路由器
bom = [
BOMItem("主板 PCB", 1, 14, on_hand=200, on_order=300),
BOMItem("CPU 芯片", 1, 21, on_hand=100, on_order=0),
BOMItem("内存颗粒", 2, 14, on_hand=500, on_order=500),
BOMItem("外壳", 1, 7, on_hand=800, on_order=0),
BOMItem("电源模块", 1, 10, on_hand=150, on_order=200),
BOMItem("螺丝", 8, 3, on_hand=10000, on_order=0),
]
order = ProductionOrder("路由器 X100", 1000, "2024-04-15")
mrp = MRPCalculator(bom)
print(f"=== MRP: {order.product} x{order.quantity} ===")
for item in mrp.calculate(order):
status = "⚠️" if item["需下单"] == "是" else "✅"
print(f"  {status} {item['物料']}: 净需求 {item['净需求']} (提前期 {item['提前期']})")

精益生产核心工具

工具 目的 核心思想
5S 现场管理 整理、整顿、清扫、清洁、素养
看板 (Kanban) 拉动生产 下游消耗触发上游生产
价值流图 (VSM) 消除浪费 可视化整个生产流程
快速换模 (SMED) 减少切换 将内部作业转为外部作业
防错 (Poka-Yoke) 预防缺陷 设计上杜绝出错可能
TPM 全员维护 设备效率 设备零故障目标

产能管理

"""
产能规划
"""
from dataclasses import dataclass
@dataclass
class ProductionLine:
name: str
capacity_per_hour: int
hours_per_shift: int
shifts_per_day: int
working_days: int      # 每月工作日
oee: float             # 设备综合效率 (0-1)
class CapacityPlanner:
"""产能规划器"""
@staticmethod
def calculate(line: ProductionLine) -> dict:
"""计算产能"""
theoretical = (
line.capacity_per_hour
* line.hours_per_shift
* line.shifts_per_day
* line.working_days
)
actual = theoretical * line.oee
return {
"产线": line.name,
"理论产能": f"{theoretical:,} 件/月",
"实际产能": f"{actual:,.0f} 件/月",
"OEE": f"{line.oee*100:.0f}%",
"瓶颈分析": (
"产能充足" if line.oee >= 0.85
else "正常水平" if line.oee >= 0.65
else "需要改善"
),
}
@staticmethod
def oee_breakdown(
availability: float,
performance: float,
quality: float,
) -> dict:
"""OEE 分解"""
oee = availability * performance * quality
return {
"OEE": f"{oee*100:.1f}%",
"可用性": f"{availability*100:.1f}% (设备开机率)",
"性能": f"{performance*100:.1f}% (实际速度/设计速度)",
"质量": f"{quality*100:.1f}% (良品率)",
"评级": (
"世界级" if oee >= 0.85
else "优秀" if oee >= 0.75
else "需改善"
),
}
planner = CapacityPlanner()
# 产线产能
line = ProductionLine(
name="SMT 贴片线",
capacity_per_hour=500,
hours_per_shift=8,
shifts_per_day=2,
working_days=22,
oee=0.78,
)
print("=== 产能规划 ===")
for k, v in planner.calculate(line).items():
print(f"  {k}: {v}")
# OEE 分解
print("\n=== OEE 分解 ===")
for k, v in planner.oee_breakdown(0.90, 0.88, 0.98).items():
print(f"  {k}: {v}")

生产计划方法对比

方法 驱动方式 适合 库存水平
MTS 备库生产 预测驱动 标准品、快消
MTO 按单生产 订单驱动 定制品
ATO 组装生产 混合 可配置产品
ETO 工程生产 项目驱动 大型设备 极低

下一章:仓储与库存管理——存储和流转的艺术。