feat(stock): stock.warehouse.search 返回新增 images 商品图片列表
- stock_store.search 批查 wms_file_reference(business_type=stock)+wms_file, 按 display_order 升序注入 item.images,无图片返回空数组(口径与 list 一致) - 同步更新 methods/system.json response 字段与 methods/changes/system.json 变更记录
This commit is contained in:
parent
f1a487bb06
commit
0dc7e1cd09
@ -3824,6 +3824,38 @@ class stockStoreService extends Service {
|
||||
return result;
|
||||
});
|
||||
|
||||
// 批查商品图片(与 stock.warehouse.list 一致:wms_file_reference + wms_file)
|
||||
if (formattedResults.length > 0) {
|
||||
const stockIds = formattedResults.map(r => r.id);
|
||||
const imageRows = await app.model.FileReference.findAll({
|
||||
where: {
|
||||
business_type: 'stock',
|
||||
business_id: { [Op.in]: stockIds.map(String) },
|
||||
},
|
||||
include: [{
|
||||
model: app.model.File,
|
||||
as: 'file',
|
||||
attributes: [ 'file_url' ],
|
||||
required: false,
|
||||
}],
|
||||
order: [[ 'display_order', 'ASC' ]],
|
||||
raw: true,
|
||||
});
|
||||
|
||||
const imageMap = new Map();
|
||||
for (const row of imageRows) {
|
||||
const sid = Number(row.business_id);
|
||||
const url = (row['file.file_url'] && String(row['file.file_url']).trim()) || '';
|
||||
if (!url) continue;
|
||||
if (!imageMap.has(sid)) imageMap.set(sid, []);
|
||||
imageMap.get(sid).push(url);
|
||||
}
|
||||
|
||||
for (const item of formattedResults) {
|
||||
item.images = imageMap.get(item.id) || [];
|
||||
}
|
||||
}
|
||||
|
||||
// with_stock=true 时关联查询库存数据
|
||||
if (with_stock && formattedResults.length > 0) {
|
||||
const stockIds = formattedResults.map(r => r.id);
|
||||
|
||||
@ -1,4 +1,21 @@
|
||||
[
|
||||
{
|
||||
"version": "2026.08.21-storage.entry.list-row-quantity",
|
||||
"date": "2026-08-21",
|
||||
"type": "enhanced",
|
||||
"summary": "storage.entry.list / storage.entry.listStore 列表每行新增 total_quantity(该入库单商品总数量,计划数)与 received_quantity(已入库数量)字段:按当前页入库单批量聚合 wms_entry_items 明细(SUM(count)/SUM(received_quantity))注入,与 total_order_lines(单据总行数/品类数)区分,无明细行时补 0。",
|
||||
"methods": [
|
||||
"storage.entry.list",
|
||||
"storage.entry.listStore"
|
||||
],
|
||||
"notes": [
|
||||
"app/service/systems/storage/entry.js list:receivingBindings 批量查询后新增按 order_id 分组的 EntryItems 聚合,注入 enrichedRows 每行的 total_quantity/received_quantity",
|
||||
"聚合仅针对当前页入库单 ID,不影响筛选/分页/排序逻辑",
|
||||
"向后兼容:仅新增行级字段,list/pagination/summary 既有结构不变",
|
||||
"同步更新 methods/system.json 中 storage.entry.list 与 storage.entry.listStore 的 response(新增 list[].total_quantity / list[].received_quantity)"
|
||||
],
|
||||
"module": "storage"
|
||||
},
|
||||
{
|
||||
"version": "2026.08.21-returnUnpack.orderLocationLane",
|
||||
"date": "2026-08-21",
|
||||
@ -32,6 +49,64 @@
|
||||
],
|
||||
"module": "returnUnpack"
|
||||
},
|
||||
{
|
||||
"version": "2026.08.21-stock.warehouse.search-return-images",
|
||||
"date": "2026-08-21",
|
||||
"type": "enhanced",
|
||||
"summary": "stock.warehouse.search 默认模式返回数据新增 images 字段:批查 wms_file_reference(business_type=stock)+ wms_file 获取商品图片URL列表,按 display_order 升序;无图片时返回空数组。mode=\"combo\" 时不返回该字段。",
|
||||
"methods": [
|
||||
"stock.warehouse.search"
|
||||
],
|
||||
"notes": [
|
||||
"app/service/systems/stock_store.js search:formattedResults 生成后批量查询 FileReference(include File.file_url,raw),按 business_id(商品ID)分组注入 item.images,与 stock.warehouse.list 图片口径一致",
|
||||
"同步更新 methods/system.json 中 stock.warehouse.search 的 response 字段"
|
||||
],
|
||||
"module": "stock"
|
||||
},
|
||||
{
|
||||
"version": "2026.08.21-order.pendingOrder.cloneOrder-sync-status-inherit",
|
||||
"date": "2026-08-21",
|
||||
"type": "enhanced",
|
||||
"summary": "order.pendingOrder.cloneOrder 同步状态继承原订单:原订单已同步(sync_status=fin)时新订单直接置 fin,避免克隆后重复回传平台;原订单未同步/同步失败(padding/error)则重置为 padding 重新走同步流程。",
|
||||
"methods": [
|
||||
"order.pendingOrder.cloneOrder"
|
||||
],
|
||||
"notes": [
|
||||
"app/service/systemMethods/order/pendingOrder.js cloneOrder 第 4 步 newOrderData.sync_status 按 original.sync_status 判定:fin→fin,其余→padding(RESET_FIELDS 保留 padding 兜底)",
|
||||
"已同步新订单分配运单号不受 sync_status 限制(createWaybillCodePipeline 只校验 step 1/2/3/4、status、拦截、锁定、已分配运单号),但新订单 step=0 需先审核进入待处理才能分配;已同步订单分配新运单号后不会自动回传平台",
|
||||
"同步更新 methods/system.json 中 cloneOrder 的 description"
|
||||
],
|
||||
"module": "order"
|
||||
},
|
||||
{
|
||||
"version": "2026.08.21-order.pendingOrder.cloneOrder-storage-release-tolerant",
|
||||
"date": "2026-08-21",
|
||||
"type": "enhanced",
|
||||
"summary": "order.pendingOrder.cloneOrder 支持克隆已同步(sync_status=fin)订单且库存释放失败不阻断:原订单已分配储位时先清除已分配库存,cancelAllocateStorage 失败降级为告警(与 cancelOrder 策略一致),克隆继续执行;残留占用保留在原订单名下,克隆新订单不重新占用库存(storage_status=none,创建过程不触发储位分配与库存锁定)。",
|
||||
"methods": [
|
||||
"order.pendingOrder.cloneOrder"
|
||||
],
|
||||
"notes": [
|
||||
"app/service/systemMethods/order/pendingOrder.js cloneOrder 第 2 步:清除已分配库存失败由抛错阻断改为 ctx.logger.warn 降级,不影响克隆主流程",
|
||||
"克隆新订单库存零占用(storage_status 重置 none、无自动储位分配),后续如需发货需在待处理工作台重新分配储位",
|
||||
"同步更新 methods/system.json 中 cloneOrder 的 description"
|
||||
],
|
||||
"module": "order"
|
||||
},
|
||||
{
|
||||
"version": "2026.08.21-order.pendingOrder.cloneOrder-unique-delivery-code",
|
||||
"date": "2026-08-21",
|
||||
"type": "fixed",
|
||||
"summary": "修复 order.pendingOrder.cloneOrder 复制原单号导致唯一键冲突:新订单 delivery_order_code 重新生成(SYS+时间戳+随机4位,与 createOrder 同规则),原单号写入 pre_delivery_order_code 保留克隆追溯链;此前复制原单号会命中 (delivery_order_code, store_id, warehouse_id) 唯一索引,克隆报「Validation error」且原订单已被取消、新订单未创建(原订单损坏)。",
|
||||
"methods": [
|
||||
"order.pendingOrder.cloneOrder"
|
||||
],
|
||||
"notes": [
|
||||
"app/service/systemMethods/order/pendingOrder.js cloneOrder:COPY_FIELDS 移除 delivery_order_code,新订单单号改为 SYS${Date.now()}${1000~9999 随机} 生成;原订单无 pre_delivery_order_code 时写入原单号保留追溯链;注释说明唯一索引约束与 UniqueConstraintError 表现",
|
||||
"同步更新 methods/system.json 中 cloneOrder 的 description"
|
||||
],
|
||||
"module": "order"
|
||||
},
|
||||
{
|
||||
"version": "2026.08.21-index.searchSpaces-batch-search",
|
||||
"date": "2026-08-21",
|
||||
|
||||
@ -3982,7 +3982,7 @@
|
||||
},
|
||||
{
|
||||
"method": "order.pendingOrder.cloneOrder",
|
||||
"description": "克隆待处理订单。完整流程:1. 查找原订单,校验可取消状态(step 0/1/2/3);2. 若原订单已分配储位(storage_status='fin'),先清除已分配库存;3. 取消原订单(step→9, status→cancel),记录克隆日志;4. 以原订单业务数据创建新订单,所有流程状态字段重置为初始落库状态;5. 克隆订单明细(含 stock_id),重置 order_id 为新订单 ID;6. 对新订单记录克隆创建日志。",
|
||||
"description": "克隆待处理订单(含已同步 sync_status=fin 订单)。完整流程:1. 查找原订单,校验可取消状态(step 0/1/2/3);2. 若原订单已分配储位(storage_status='fin'),先清除已分配库存,释放失败不阻断克隆(残留占用保留在原订单名下);3. 取消原订单(step→9, status→cancel),记录克隆日志;4. 以原订单业务数据创建新订单,所有流程状态字段重置为初始落库状态,发货单号重新生成为 SYS 前缀新单号(受唯一索引 delivery_order_code+store_id+warehouse_id 约束,不可复制原单号),原单号写入 pre_delivery_order_code 保留克隆追溯链,同步状态继承原订单(原订单已同步 sync_status=fin 则新订单直接置 fin 避免重复回传,否则重置 padding 重新同步);5. 克隆订单明细(含 stock_id),重置 order_id 为新订单 ID;6. 对新订单记录克隆创建日志。克隆新订单不重新占用库存(storage_status=none,不触发储位分配与库存锁定)。",
|
||||
"isNeedAuth": true,
|
||||
"isNeedLogin": true,
|
||||
"headers": [
|
||||
@ -17920,6 +17920,12 @@
|
||||
"description": "商品条形码列表(string[])。mode=\"combo\" 时不返回此字段",
|
||||
"required": false
|
||||
},
|
||||
{
|
||||
"name": "images",
|
||||
"type": "array",
|
||||
"description": "商品图片URL列表(string[]),来自 wms_file_reference(business_type=stock)关联 wms_file.file_url,按 display_order 升序;无图片时为空数组。mode=\"combo\" 时不返回此字段",
|
||||
"required": false
|
||||
},
|
||||
{
|
||||
"name": "store_stock",
|
||||
"type": "object",
|
||||
@ -21803,6 +21809,18 @@
|
||||
"required": true,
|
||||
"description": "入库单列表"
|
||||
},
|
||||
{
|
||||
"name": "list[].total_quantity",
|
||||
"type": "number",
|
||||
"required": true,
|
||||
"description": "该入库单商品总数量(计划数,明细 count 合计,区别于 total_order_lines 单据总行数/品类数)"
|
||||
},
|
||||
{
|
||||
"name": "list[].received_quantity",
|
||||
"type": "number",
|
||||
"required": true,
|
||||
"description": "该入库单已入库数量(明细 received_quantity 合计)"
|
||||
},
|
||||
{
|
||||
"name": "pagination",
|
||||
"type": "object",
|
||||
@ -21884,6 +21902,18 @@
|
||||
"required": true,
|
||||
"description": "入库单列表"
|
||||
},
|
||||
{
|
||||
"name": "list[].total_quantity",
|
||||
"type": "number",
|
||||
"required": true,
|
||||
"description": "该入库单商品总数量(计划数,明细 count 合计,区别于 total_order_lines 单据总行数/品类数)"
|
||||
},
|
||||
{
|
||||
"name": "list[].received_quantity",
|
||||
"type": "number",
|
||||
"required": true,
|
||||
"description": "该入库单已入库数量(明细 received_quantity 合计)"
|
||||
},
|
||||
{
|
||||
"name": "pagination",
|
||||
"type": "object",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user