diff --git a/inventory-backend/app/api/v1/inbound/stock.py b/inventory-backend/app/api/v1/inbound/stock.py
index 7dc29b0..0b612b4 100644
--- a/inventory-backend/app/api/v1/inbound/stock.py
+++ b/inventory-backend/app/api/v1/inbound/stock.py
@@ -2390,7 +2390,14 @@ def update_stocktake_quantity():
draft = query.first()
if not draft:
- return jsonify({'code': 404, 'msg': '未找到盘点记录'}), 404
+ # 该物料在本会话尚未扫码 → 没有草稿行可改。
+ # 前端已把未扫行的实盘数置为不可编辑,这里是兜底(例如页面未刷新、
+ # 或有人直接调接口)。刻意**不**在此处补建草稿 —— 一旦允许不扫码
+ # 就能填数,扫码这道工序就形同虚设,盘盈盘亏也无从查起。
+ return jsonify({
+ 'code': 404,
+ 'msg': '该物料尚未扫码,请先扫描条码后再修改实盘数'
+ }), 404
# 更新数量
draft.quantity = quantity
diff --git a/inventory-web/src/views/stock/stocktake/index.vue b/inventory-web/src/views/stock/stocktake/index.vue
index fac26a3..4247277 100644
--- a/inventory-web/src/views/stock/stocktake/index.vue
+++ b/inventory-web/src/views/stock/stocktake/index.vue
@@ -454,9 +454,16 @@
{{ row.stock_qty }}
+
+
+ 未扫
+
{
session_id: currentSessionId.value // ★ 传入会话ID,后端按会话隔离更新
}, selectedCompany.value || undefined)
ElMessage.success('实盘数已更新')
- } catch (e) {
+ } catch (e: any) {
console.error('更新实盘数失败', e)
- ElMessage.error('更新失败')
- // 重新获取列表数据
+ ElMessage.error(e?.response?.data?.msg || e?.msg || '实盘数更新失败,已还原为服务端数据')
+ // 拉回服务端最新数据,覆盖掉本地已被 v-model 改动的值
fetchInventoryList()
}
}
@@ -1841,6 +1848,13 @@ const goToVarianceReview = () => {
/* 盲盘时后端不下发账面数/差异,用「—」表示未下发(区别于真实的 0) */
.cell-blinded { color: #c0c4cc; }
+/* 未扫过的行不给填数,只给一个提示 —— 引导工人去扫码而不是抄账面 */
+.not-scanned-hint {
+ font-size: 12px;
+ color: #c0c4cc;
+ cursor: help;
+}
+
/* ★ 创建盘点任务表单(模式 / 范围) */
.task-form {
width: 100%;