Files
star 639d7f1545 feat: BOM型号可编辑 + 生产订单BOM去括号 + 物料明细各工厂实时库存
- BOM编辑页「型号」输入框取消 readonly,可修改;bom_edit 增加非空与唯一校验(重复提示「BOM 型号已存在」、空值提示「BOM 型号必填」),改名不影响关联生产订单与流水
- 生产订单列表/详情/表单中 BOM 显示由 CODE (NAME) 改为 CODE · NAME,去掉括号
- 物料明细页新增「各工厂实时库存」表(工厂编号/名称/实时库存),显示每个工厂的实时聚合库存(入−出),不受顶栏工厂过滤影响
2026-10-15 14:03:16 +08:00

45 lines
2.0 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ '编辑 BOM' if b else '新增 BOM' }}{% endblock %}
{% block content %}
<form method="post" class="card form-card" style="max-width:640px">
<h3>{{ '编辑 BOM' if b else '新增 BOM' }}</h3>
<label>BOM 型号 *</label>
<input name="code" value="{{ form_code if form_code is defined else (b.code if b else '') }}" required>
<label>名称</label>
<input name="name" value="{{ b.name if b else '' }}">
<label>备注</label>
<input name="note" value="{{ b.note if b else '' }}">
<h3>组成物料 (单套用量)</h3>
<div id="items">
{% for it in items %}
<div class="item-row" style="display:flex;gap:8px;margin-bottom:6px">
<input name="pn" placeholder="物料编号" value="{{ it.pn }}" style="flex:2">
<input name="qty" type="number" step="0.01" min="0" placeholder="单套用量" value="{{ it.qty }}" style="flex:1">
<button type="button" class="del" onclick="this.parentNode.remove()">✕</button>
</div>
{% else %}
<div class="item-row" style="display:flex;gap:8px;margin-bottom:6px">
<input name="pn" placeholder="物料编号" style="flex:2">
<input name="qty" type="number" step="0.01" min="0" placeholder="单套用量" style="flex:1">
<button type="button" class="del" onclick="this.parentNode.remove()">✕</button>
</div>
{% endfor %}
</div>
<button type="button" class="btn" onclick="addRow()">+ 添加一行</button>
<div class="row-actions"><button class="primary">保存</button></div>
</form>
<script>
function addRow(){
const d=document.createElement('div');
d.className='item-row';
d.style='display:flex;gap:8px;margin-bottom:6px';
d.innerHTML='<input name="pn" placeholder="物料编号" style="flex:2">'+
'<input name="qty" type="number" step="0.01" min="0" placeholder="单套用量" style="flex:1">'+
'<button type="button" class="del" onclick="this.parentNode.remove()">✕</button>';
document.getElementById('items').appendChild(d);
}
</script>
{% endblock %}