feat: 生产订单新增导出 Excel 与打印功能
- 订单列表页「导出 Excel」(/orders/export): 导出全部生产订单(订单号/BOM/接单量/工厂/状态/经手人/下单时间/备注) - 订单详情页「导出 Excel」(/order/<id>/export): 导出派工单, 含「订单信息」+「领料明细」双 sheet - 订单详情页「打印」按钮: window.print() + @media print 样式(隐藏导航/按钮, 输入框转纯文本, 隐藏提示), 输出干净派工单
This commit is contained in:
@@ -1,16 +1,36 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}订单 {{ o.order_no }}{% endblock %}
|
||||
{% block content %}
|
||||
<style>
|
||||
/* 打印(派工单): 仅保留订单信息与明细表, 隐藏导航/按钮, 输入框显示为纯文本 */
|
||||
@media print {
|
||||
header.topbar { display: none !important; }
|
||||
.toolbar .btn, .toolbar a.btn, .toolbar button { display: none !important; }
|
||||
.toolbar .badge { display: inline-block !important; }
|
||||
.row-actions { display: none !important; }
|
||||
.print-hide { display: none !important; }
|
||||
input[name^="alloc_"] {
|
||||
border: none !important; background: none !important; padding: 0 !important;
|
||||
width: auto !important; -webkit-appearance: none; appearance: none;
|
||||
font: inherit; color: inherit;
|
||||
}
|
||||
form { display: block; }
|
||||
@page { margin: 12mm; }
|
||||
body { background: #fff !important; }
|
||||
}
|
||||
</style>
|
||||
<div class="toolbar">
|
||||
<h3 style="margin:0">生产订单 {{ o.order_no }}</h3>
|
||||
<span class="badge {{ 'ok' if o.status=='picked' else 'warn' }}">{{ '已领料' if o.status=='picked' else '待领料' }}</span>
|
||||
<a class="btn" href="{{ url_for('order_edit', oid=o.id) }}">编辑订单</a>
|
||||
<a class="btn" href="{{ url_for('order_export', oid=o.id) }}">导出 Excel</a>
|
||||
<button class="btn" type="button" onclick="window.print()">打印</button>
|
||||
</div>
|
||||
<div class="card" style="margin-bottom:16px">
|
||||
<p class="small muted" style="margin-top:0"><b>下单信息(按下单时记录)</b></p>
|
||||
<p>BOM: <b>{{ bom.code if bom else '-' }}</b>{% if bom and bom.name %} · {{ bom.name }}{% endif %} | 接单量: <b>{{ '%.2f'|format(o.qty) }}</b> | 生产工厂: <b>{% if factory %}{{ factory.code }}{% if factory.name %} · {{ factory.name }}{% endif %}{% else %}未指定(按汇总库存){% endif %}</b> | 经手人: {{ o.operator or '-' }}{% if o.created_at %} | 下单时间: {{ o.created_at.strftime('%Y-%m-%d %H:%M') }}{% endif %}</p>
|
||||
{% if o.remark %}<p class="small muted">备注: {{ o.remark }}</p>{% endif %}
|
||||
<p class="small muted" style="margin-bottom:0">提示:点击「编辑订单」保存后,该订单会冲销已产生的调入/领料流水并清空调入计划,自动回到「刚下单」状态(待领料、未调拨),可重新规划。</p>
|
||||
<p class="small muted print-hide" style="margin-bottom:0">提示:点击「编辑订单」保存后,该订单会冲销已产生的调入/领料流水并清空调入计划,自动回到「刚下单」状态(待领料、未调拨),可重新规划。</p>
|
||||
</div>
|
||||
|
||||
<h3>领料需求与调入 (单套用量 × 接单量){% if factory %} | 按下单前库存核算{% endif %}</h3>
|
||||
@@ -73,7 +93,7 @@
|
||||
formaction="{{ url_for('order_alloc_post', oid=o.id) }}"
|
||||
onclick="return confirm('确认将待调入数量从上方所选来源工厂调拨到生产工厂? 总库存不变, 仅厂间转移。');">确认调入(厂间调拨)</button>
|
||||
</div>
|
||||
<p class="small muted">「确认调入」是一次厂间调拨:从来源工厂出库减、生产工厂入库加,系统总库存不变。</p>
|
||||
<p class="small muted print-hide">「确认调入」是一次厂间调拨:从来源工厂出库减、生产工厂入库加,系统总库存不变。</p>
|
||||
</form>
|
||||
|
||||
<div class="card" style="margin:14px 0">
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user