You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

能否实现印刷工序间物料损耗的逐行连续计算?

工序物料损耗连续计算实现方法

一、用Excel/Google Sheets快速实现

按你给出的表格结构,直接通过单元格引用就能完成物料量的自动传递:

  • 先在工序1的material at the start单元格(比如B2)输入初始值1000,material at the end单元格(D2)写入公式:=B2*(1-C2/100),算出900。
  • 工序2的material at the start单元格(B3)直接引用上一道工序的结束值:=D2,再把D2的公式复制到D3,就能得到765。
  • 选中B3和D3,往下拉填充,后续所有工序都会自动继承上一行的结束物料量,完成连续计算。

二、用Python脚本批量处理(适合大量工序或自动化场景)

如果需要处理多组数据或者整合到业务系统里,用Python脚本更高效:

# 定义工序损耗数据,可按需添加更多工序
processes = [(1, 10), (2, 15), (3, 12)]
initial_material = 1000

result = []
current_material = initial_material

for step, loss_rate in processes:
    start = current_material
    end = round(start * (1 - loss_rate / 100))
    result.append({
        "process step": step,
        "material at the start": start,
        "loss in %": loss_rate,
        "material at the end": end
    })

# 输出格式化表格
print("| process step | material at the start | loss in % | material at the end |")
print("|--------------|-----------------------|-----------|---------------------|")
for row in result:
    print(f"| {row['process step']} | {row['material at the start']} | {row['loss in %']} | {row['material at the end']} |")

运行后会直接输出和示例一致的计算结果,后续新增工序时,只需要在processes列表里添加对应的工序号和损耗率即可。

内容的提问来源于stack exchange,提问作者AJM

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.02 01:07:12