- 多工厂(factory 表) + 顶栏工厂下拉过滤, 库存按厂聚合 - 厂间调拨(transfer): 源厂减+目标厂加, 总库存不变, 双向流水对账 - 替代料关系(substitute): 出库/BOM领料/生产领料缺料时提示可替代料 - 流水台账(ledger): 入出按日期合并折叠, 按日期导出同一 Excel - 生产订单增强: 编辑/删除(级联清关联流水)/调入数量/确认调入=厂间调拨 - 入库新增送货日期字段; 出库物料编码扫码定位 - 重写 README 补全全部模块; .gitignore 排除 dist_pkg/build_pkg/*.db - 停止跟踪 instance/app.db(运行时自动生成)
66 lines
2.9 KiB
HTML
66 lines
2.9 KiB
HTML
{% extends "base.html" %}
|
||
{% block title %}替代料关系{% endblock %}
|
||
{% block content %}
|
||
|
||
<div class="toolbar">
|
||
<h3 style="margin:0">🔁 替代料关系</h3>
|
||
<form method="post" action="{{ url_for('substitute_import') }}" enctype="multipart/form-data" style="display:flex;gap:8px;align-items:center">
|
||
<span class="small muted">从「替代料」Excel 批量导入:</span>
|
||
<input type="file" name="file" accept=".xlsx,.xls" required>
|
||
<button class="primary" type="submit">导入</button>
|
||
</form>
|
||
</div>
|
||
<p class="small muted">登记「某主料可由哪些替代料替代」。出库 / BOM 领料时,若主料库存不足,系统会自动提示可用的替代料。当前按{% if factory %}工厂 {{ factory.code }}{% else %}全部工厂汇总{% endif %}库存核算。</p>
|
||
|
||
<div class="card form-card" style="max-width:720px;margin-bottom:18px">
|
||
<h4 style="margin-top:0">+ 新增替代关系</h4>
|
||
<form method="post" action="{{ url_for('substitutes') }}">
|
||
<input type="hidden" name="action" value="add">
|
||
<label>主料 *</label>
|
||
<select name="main_id" required>
|
||
<option value="">-- 选择主料 --</option>
|
||
{% for m in mats %}
|
||
<option value="{{ m.id }}">{{ m.part_number }} ({{ m.manufacturer or '-' }})</option>
|
||
{% endfor %}
|
||
</select>
|
||
<label>替代料 *</label>
|
||
<select name="sub_id" required>
|
||
<option value="">-- 选择替代料 --</option>
|
||
{% for m in mats %}
|
||
<option value="{{ m.id }}">{{ m.part_number }} ({{ m.manufacturer or '-' }})</option>
|
||
{% endfor %}
|
||
</select>
|
||
<label>备注</label>
|
||
<input name="note" placeholder="如 替代型号说明">
|
||
<div class="row-actions"><button class="primary" type="submit">添加</button></div>
|
||
</form>
|
||
</div>
|
||
|
||
<h3>已登记关系({{ rows|length }} 条)</h3>
|
||
<table class="tbl">
|
||
<thead><tr>
|
||
<th>主料编号</th><th>主料型号</th><th>替代料编号</th><th>替代料型号</th>
|
||
<th>替代料当前库存</th><th>备注</th><th>操作</th>
|
||
</tr></thead>
|
||
<tbody>
|
||
{% for r in rows %}
|
||
<tr>
|
||
<td><a href="{{ url_for('material_detail', mid=r.main.id) }}">{{ r.main.part_number }}</a></td>
|
||
<td>{{ r.main.manufacturer or '-' }}</td>
|
||
<td><a href="{{ url_for('material_detail', mid=r.sub.id) }}">{{ r.sub.part_number }}</a></td>
|
||
<td>{{ r.sub.manufacturer or '-' }}</td>
|
||
<td class="num {{ 'row-in' if r.stock>0 else 'row-out' }}">{{ '%.2f'|format(r.stock) }}</td>
|
||
<td>{{ r.note or '-' }}</td>
|
||
<td>
|
||
<form method="post" action="{{ url_for('substitute_delete', sid=r.id) }}" onsubmit="return confirm('确认删除该替代关系?');">
|
||
<button class="btn danger" type="submit">删除</button>
|
||
</form>
|
||
</td>
|
||
</tr>
|
||
{% else %}
|
||
<tr><td colspan="7" class="muted">暂无替代关系,可手动新增或从 Excel 导入。</td></tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
{% endblock %}
|