Files
Inventory-Management-System/templates/orders.html
T
starandWorkBuddy 93f3ef458b feat: 生产订单支持一次多选 BOM 且各 BOM 独立设置生产数量
- 新增中间表 prod_order_bom(order_id, bom_id, qty),一个订单可挂多个 BOM,每个 BOM 单独设生产数量
- prod_order.qty 改为各 BOM 数量汇总,bom_id 仅作主 BOM 冗余摘要
- 物料需求按 Σ(BOM 单套用量 × 各自生产数量) 跨 BOM 合并聚合,覆盖详情/领料/调入/导出
- 订单表单改为动态多行(BOM 下拉 + 数量输入 + 删除行),列表与导出展示「BOM清单(型号×数量)」
- 导出 Excel 增至 3 个 sheet:订单信息 / BOM清单 / 领料明细
- 修复 _parse_bom_pairs 表单字段名 bom_id[]/qty[] 解析;order_delete 一并级联删除 prod_order_bom
- build_exe.py 增加构建后自动拷贝 dist_pkg→dist(EXE 同目录即数据库所在)

Co-Authored-By: WorkBuddy <workbuddy@tencent.com>
2026-10-26 10:24:25 +08:00

35 lines
1.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends "base.html" %}
{% block title %}生产订单{% endblock %}
{% block content %}
<div class="toolbar">
<h3 style="margin:0">生产订单 ({{ data|length }})</h3>
<a class="btn primary" href="{{ url_for('order_new') }}">+ 新建订单</a>
<a class="btn" href="{{ url_for('orders_export') }}">导出 Excel</a>
</div>
<table class="tbl">
<thead><tr><th>订单号</th><th>BOM 清单(型号 × 数量)</th><th>总接单量</th><th>生产工厂</th><th>状态</th><th>经手人</th><th>操作</th></tr></thead>
<tbody>
{% for d in data %}
<tr>
<td>{{ d.o.order_no }}</td>
<td>{% for b, q in d.lines %}<div>{{ b.code }}{% if b.name %} · {{ b.name }}{% endif %} × {{ '%.2f'|format(q) }}</div>{% else %}-{% endfor %}</td>
<td class="num">{{ '%.2f'|format(d.total) }}</td>
<td>{% if d.factory %}{{ d.factory.code }}{% if d.factory.name %} · {{ d.factory.name }}{% endif %}{% else %}未指定{% endif %}</td>
<td><span class="badge {{ 'ok' if d.o.status=='picked' else 'warn' }}">{{ '已领料' if d.o.status=='picked' else '待领料' }}</span></td>
<td>{{ d.o.operator or '-' }}</td>
<td class="row-actions">
<a href="{{ url_for('order_detail', oid=d.o.id) }}">查看</a>
<a href="{{ url_for('order_edit', oid=d.o.id) }}">编辑</a>
<form method="post" action="{{ url_for('order_delete', oid=d.o.id) }}" style="display:inline"
onsubmit="return confirm('确认删除生产订单 {{ d.o.order_no }}? 关联出入库流水将保留。');">
<button class="link-danger" type="submit">删除</button>
</form>
</td>
</tr>
{% else %}
<tr><td colspan="7" class="muted">还没有生产订单</td></tr>
{% endfor %}
</tbody>
</table>
{% endblock %}