feat: 多工厂/厂间调拨/替代料/流水台账折叠 + 重写 README

- 多工厂(factory 表) + 顶栏工厂下拉过滤, 库存按厂聚合
- 厂间调拨(transfer): 源厂减+目标厂加, 总库存不变, 双向流水对账
- 替代料关系(substitute): 出库/BOM领料/生产领料缺料时提示可替代料
- 流水台账(ledger): 入出按日期合并折叠, 按日期导出同一 Excel
- 生产订单增强: 编辑/删除(级联清关联流水)/调入数量/确认调入=厂间调拨
- 入库新增送货日期字段; 出库物料编码扫码定位
- 重写 README 补全全部模块; .gitignore 排除 dist_pkg/build_pkg/*.db
- 停止跟踪 instance/app.db(运行时自动生成)
This commit is contained in:
2026-09-29 11:17:48 +08:00
parent 33efc7c846
commit 5060d027e5
22 changed files with 1961 additions and 149 deletions
+61
View File
@@ -0,0 +1,61 @@
{% extends "base.html" %}
{% block title %}工厂 / 代工厂管理{% endblock %}
{% block content %}
<div class="toolbar">
<h3 style="margin:0">工厂 / 代工厂管理</h3>
</div>
<div class="card" style="margin-bottom:16px">
<form method="post" class="form-card" style="display:flex;flex-wrap:wrap;gap:12px;align-items:flex-end">
<div>
<label>工厂编码 *</label>
<input name="code" placeholder="如 SUB01" required style="text-transform:uppercase">
</div>
<div>
<label>工厂名称</label>
<input name="name" placeholder="如 东莞代工厂A">
</div>
<div>
<label>类型</label>
<select name="type">
<option value="self">自厂</option>
<option value="subcontract">代工厂</option>
</select>
</div>
<button class="primary" type="submit">+ 添加工厂</button>
</form>
</div>
<table class="tbl">
<thead>
<tr><th>编码</th><th>名称</th><th>类型</th><th>状态</th><th>操作</th></tr>
</thead>
<tbody>
{% for f in fs %}
<tr>
<td>{{ f.code }}</td>
<td>{{ f.name or '-' }}</td>
<td>{% if f.type == 'subcontract' %}代工厂{% else %}自厂{% endif %}</td>
<td>
{% if f.enabled %}<span class="badge ok">启用</span>
{% else %}<span class="badge warn">停用</span>{% endif %}
</td>
<td>
<a class="btn" href="{{ url_for('factory_workbench', fid=f.id) }}">进入</a>
<form method="post" action="{{ url_for('factory_toggle', fid=f.id) }}" style="display:inline">
<button class="btn" type="submit">{% if f.enabled %}停用{% else %}启用{% endif %}</button>
</form>
</td>
</tr>
{% else %}
<tr><td colspan="5" class="muted">暂无工厂, 请先添加</td></tr>
{% endfor %}
</tbody>
</table>
<p class="small muted" style="margin-top:14px">
说明:每笔入库 / 出库都会归属到一个工厂。顶栏"工厂"下拉可切换查看范围(选"全部工厂"为各厂汇总)。
停用后的工厂不会出现在下拉选项中,但其历史流水仍保留。
</p>
{% endblock %}