feat(shipping-notice): 通知准备履约字段就地编辑并修复缺口复核入口
- 编辑闸门翻转为状态制:Excel 生成前+无活动 Attempt 即可编辑,原因不强制(审计自动记录操作人与变更) - 修复 Decimal 字段人工编辑无法持久化(单字段+整行替换两路径) - 预约注册与核验比对改读有效订单值视图,消除编辑后重匹配 RESERVATION_MISMATCH 阻断 - 通知准备值列改读有效视图:保存即显新值,匹配结果列保持最近一轮事实 - 行编辑入口为更多操作列编辑按钮;编辑态替换为保存/取消;库存源行内改选随保存统一提交 - 展示态动作收纳进更多菜单(Teleport 浮层,防表格 overflow 裁剪) - 修复缺口复核投影键错位(has_shortage 恒 False 致入口隐藏)并补齐行级结案入口 - 缺口放行改行内补录条(菜单放行或缺 N 项徽标展开,确认放行/取消收起),放行原因可选 - i18n 四语言;technical.md/funclist.md 语义文档同步
This commit is contained in:
1 parent
4d879dd8ea
commit
eed1068ae3
29 files changed
+1981
-218
No files matched your search
@@ -130,8 +130,8 @@ def test_line_set_replacement_skips_line_overlay(app):
|
||||
"""整行替换后 position 不再可比:行级叠加保守跳过,返回冻结行值。"""
|
||||
with app.app_context():
|
||||
fixture = _seed_frozen_order()
|
||||
# 注:替换行不带 qty——编辑服务会把 decimal 字段归一为 Decimal 写入 JSON 列(SQLite/PG
|
||||
# 默认 json.dumps 均不可序列化),此既有路径与本测试的行集替换守卫无关,故省略。
|
||||
# 注:替换行不带 qty——本测试只验证行集替换守卫;decimal 经整行替换路径的可持久化
|
||||
# 已由 test_line_set_replacement_with_decimal_persists_without_json_error 单独覆盖。
|
||||
replace_current_line_fields(task=fixture.order, lines=[
|
||||
{'part_number': 'D4-A08AR12000002', 'reservation_id': 'RSV-1'},
|
||||
])
|
||||
@@ -156,6 +156,48 @@ def test_effective_line_facts_for_notice(app):
|
||||
assert first['field_values']['f-rsv'] == 'RSV-1'
|
||||
|
||||
|
||||
def test_decimal_edit_persists_without_json_error(app):
|
||||
"""数量(decimal 字段)人工编辑必须可持久化:value_json 存字符串、value_decimal 存 Decimal。"""
|
||||
with app.app_context():
|
||||
fixture = _seed_frozen_order()
|
||||
replace_current_line_field_value(
|
||||
task=fixture.order, position=0, field_code='qty', value='12.5',
|
||||
)
|
||||
rows = [
|
||||
item for item in ShippingOrderFieldValue.query.filter_by(
|
||||
extraction_id=fixture.extraction.id,
|
||||
).all()
|
||||
if item.value_json is not None
|
||||
]
|
||||
# 夹具两行均预置了 f-qty FieldValue(未编辑行 value_json='10'),须限定被编辑的第 0 行再断言。
|
||||
edited_line = ShippingOrderLine.query.filter_by(
|
||||
extraction_id=fixture.extraction.id, position=0,
|
||||
).one()
|
||||
qty_rows = [item for item in rows if item.field_id == 'f-qty' and item.line_id == edited_line.id]
|
||||
# 断言:JSON 列存规范字符串(与机器路径 _json_value 对齐),类型列保留 Decimal。
|
||||
assert qty_rows, 'qty FieldValue 必须存在'
|
||||
assert all(item.value_json == '12.5' for item in qty_rows)
|
||||
assert any(item.value_decimal == Decimal('12.5') for item in qty_rows)
|
||||
|
||||
|
||||
def test_line_set_replacement_with_decimal_persists_without_json_error(app):
|
||||
"""整行替换带 decimal 字段必须同样可持久化:新当前 Extraction 的 qty JSON 列存字符串、类型列存 Decimal。"""
|
||||
with app.app_context():
|
||||
fixture = _seed_frozen_order()
|
||||
replace_current_line_fields(task=fixture.order, lines=[
|
||||
{'part_number': 'D4-A08AR12000002', 'reservation_id': 'RSV-1', 'qty': '12.5'},
|
||||
])
|
||||
rows = ShippingOrderFieldValue.query.filter_by(
|
||||
extraction_id=fixture.order.current_order_extraction_id,
|
||||
field_id='f-qty',
|
||||
).all()
|
||||
line_qty_rows = [item for item in rows if item.line_id is not None]
|
||||
# 断言:整行替换路径的 Decision/FieldValue 均经 _json_value 落库且不得抛序列化错误。
|
||||
assert line_qty_rows, '替换行集的 qty FieldValue 必须存在'
|
||||
assert all(item.value_json == '12.5' for item in line_qty_rows)
|
||||
assert all(item.value_decimal == Decimal('12.5') for item in line_qty_rows)
|
||||
|
||||
|
||||
def test_matching_purpose_values_use_effective_view(app):
|
||||
"""库存匹配用途投影必须读到修正后的料号(修复改值不进匹配的断层)。"""
|
||||
with app.app_context():
|
||||
|
||||
Reference in new issue
Block a user