diff --git a/app/service/systems/warehouse_panel.js b/app/service/systems/warehouse_panel.js index 9b5d1cb..7135457 100644 --- a/app/service/systems/warehouse_panel.js +++ b/app/service/systems/warehouse_panel.js @@ -451,12 +451,31 @@ class WarehousePanelService extends Service { }, }), ]).then(([ currentCount, dispatchCount ]) => currentCount + dispatchCount), - this.countSql( - `SELECT COUNT(*) AS cnt FROM wms_wave_pick_task - WHERE warehouse_id = :warehouseId AND status = 1`, - { warehouseId } - ), - currentModel.count({ where: { ...pendingBase, pick_status: 'error' } }), + // 拣货中订单数:订单表 pick_status='padding'(池内 + 配送表今日出库,与已拣货同源订单表口径) + Promise.all([ + currentModel.count({ where: { ...pendingBase, pick_status: 'padding' } }), + dispatchModel.count({ + where: { + status: { [Op.ne]: 'cancel' }, + outbound_status: 'fin', + pick_status: 'padding', + delivery_time: todayRange, + dispatch_lane: { [Op.in]: [ 'm4', 'm5' ] }, + }, + }), + ]).then(([ currentCount, dispatchCount ]) => currentCount + dispatchCount), + Promise.all([ + currentModel.count({ where: { ...pendingBase, pick_status: 'error' } }), + dispatchModel.count({ + where: { + status: { [Op.ne]: 'cancel' }, + outbound_status: 'fin', + pick_status: 'error', + delivery_time: todayRange, + dispatch_lane: { [Op.in]: [ 'm4', 'm5' ] }, + }, + }), + ]).then(([ currentCount, dispatchCount ]) => currentCount + dispatchCount), Promise.all([ currentModel.count({ where: { status: { [Op.ne]: 'cancel' }, recheck_time: todayRange } }), dispatchModel.count({ @@ -474,7 +493,18 @@ class WarehousePanelService extends Service { wave_status: { [Op.in]: [ 3, 4 ] }, }, }), - currentModel.count({ where: { ...pendingBase, recheck_status: 'error' } }), + Promise.all([ + currentModel.count({ where: { ...pendingBase, recheck_status: 'error' } }), + dispatchModel.count({ + where: { + status: { [Op.ne]: 'cancel' }, + outbound_status: 'fin', + recheck_status: 'error', + delivery_time: todayRange, + dispatch_lane: { [Op.in]: [ 'm4', 'm5' ] }, + }, + }), + ]).then(([ currentCount, dispatchCount ]) => currentCount + dispatchCount), this.countSql( `SELECT (SELECT COUNT(*) FROM wms_pack_task @@ -506,7 +536,19 @@ class WarehousePanelService extends Service { }, }), ]).then(([ currentCount, dispatchCount ]) => currentCount + dispatchCount), - model.PackTask.count({ where: { warehouse_id: warehouseId, status: 3 } }), + // 打包异常订单数:订单表 pack_status='error'(池内 + 配送表今日出库,与打包中同源订单表口径) + Promise.all([ + currentModel.count({ where: { ...pendingBase, pack_status: 'error' } }), + dispatchModel.count({ + where: { + status: { [Op.ne]: 'cancel' }, + outbound_status: 'fin', + pack_status: 'error', + delivery_time: todayRange, + dispatch_lane: { [Op.in]: [ 'm4', 'm5' ] }, + }, + }), + ]).then(([ currentCount, dispatchCount ]) => currentCount + dispatchCount), ]); const stages = [ diff --git a/methods/changes/system.json b/methods/changes/system.json index 2f86016..73407e7 100644 --- a/methods/changes/system.json +++ b/methods/changes/system.json @@ -1,4 +1,18 @@ [ + { + "version": "0.3.291", + "date": "2026-10-12", + "type": "updated", + "summary": "index.getWarehousePanelData stageOverview 环节卡 doing/abnormal 统一订单表状态口径(拣货中/打包中/各环节异常)(0.3.290 → 0.3.291)", + "methods": [ + "index.getWarehousePanelData" + ], + "notes": [ + "变更内容:stageOverview 环节卡 doing/abnormal 统一订单表状态口径——拣货 doing 由拣货任务数(wms_wave_pick_task status=1)改为订单表 pick_status=padding(池内 + 配送表今日出库双表);拣货 abnormal=pick_status=error、复核 abnormal=recheck_status=error、打包 abnormal=pack_status=error 均补配送表今日出库双表;打包 abnormal 由任务数(wms_pack_task status=3)改为订单表 pack_status=error;复核 doing 保持波次口径(wms_wave_batch,订单表 recheck_status 仅有 none/fin/error 无复核中状态)。", + "代码依据:app/service/systems/warehouse_panel.js#queryStageOverview(pickDoing/pickAbnormal/recheckAbnormal/packAbnormal 改 Promise.all 双表订单状态 count);ESLint 0 错误。", + "文档变更范围:methods/system.json 的 module=index 分组仅更新 index.getWarehousePanelData 一条(response.data.description 与 notes 补环节卡口径);根版本 0.3.290 → 0.3.291、updatedAt 保持 2026-10-12;methods/changes/system.json 新增本条(插入数组首位);其余 method 未改动。" + ] + }, { "version": "0.3.290", "date": "2026-10-12", diff --git a/methods/system.json b/methods/system.json index ca8e3a9..428f079 100644 --- a/methods/system.json +++ b/methods/system.json @@ -1,7 +1,7 @@ { "module": "system", "description": "系统接口标准入口,method 对应系统内置方法,全部使用 POST 请求,参数统一放在 body 内", - "version": "0.3.290", + "version": "0.3.291", "updatedAt": "2026-10-12", "headers": [ { @@ -2621,7 +2621,7 @@ "name": "data", "type": "object", "required": true, - "description": "面板数据对象;is_change=false 时为空对象(节约流量),is_change=true 时输出。已输出字段:title(仓库名)、fulfillment(订单履约链路 6 环节未/已 + total + items 末尾两项今日退件/今日拆包;各环节未/已均含配送表今日出库按环节状态拆分补数,打包环节已* 用订单状态存量口径(池内 pack_status=fin + 配送表今日出库 pack_status=fin,保证已复核≥已打包))、stageOverview(totalOrders/interceptOrders/stages 5 卡:receiving/shelf/pick/recheck/pack,pack 卡 today=今日已完成打包的真实订单数(status=2,不含打包中):散单任务数 + 团购波次 wms_order_wave_index 真实订单数(替代 pack_quantity 快照),doing=打包中订单数(订单表 pack_status=padding 池内+配送今日出库双表)、abnormal 为任务数)、b2b(orders/goods/sku)、groupPicking、scatterPicking(orders/goods/sku/wave/top5)、groupPacking、scatterPacking(各含 orders/goods/sku/wave/top5,按波次范围 wave_scope 区分:团购块 top 按打包台、散单块 top 按打包员)、trend(max/total/points 业务日 24 点:label 从仓库自然日开始时间(day_start_time)起到次日自然日开始时间,每点 { label, created_count }——created_count=业务日窗口内下单量(池内待处理 + 配送表今日出库订单按订单创建时间落桶,窗口即业务日 [自然日开始时间, 次日自然日开始时间):未到次日自然日开始时间时=今日自然日开始时间起,凌晨(已过零点)时=昨日自然日开始时间起)并按小时累计(最后一点=业务日内下单总量);total=今日总单量(与 fulfillment.total 同口径:待处理订单池 + 配送表今日出库))、weeklyEfficiency(days 7 天 intercept)" + "description": "面板数据对象;is_change=false 时为空对象(节约流量),is_change=true 时输出。已输出字段:title(仓库名)、fulfillment(订单履约链路 6 环节未/已 + total + items 末尾两项今日退件/今日拆包;各环节未/已均含配送表今日出库按环节状态拆分补数,打包环节已* 用订单状态存量口径(池内 pack_status=fin + 配送表今日出库 pack_status=fin,保证已复核≥已打包))、stageOverview(totalOrders/interceptOrders/stages 5 卡:receiving/shelf/pick/recheck/pack,pack 卡 today=今日已完成打包的真实订单数(status=2,不含打包中):散单任务数 + 团购波次 wms_order_wave_index 真实订单数(替代 pack_quantity 快照),doing=打包中订单数(订单表 pack_status=padding 池内+配送今日出库双表)、abnormal=异常订单数(订单表对应状态 error 池内+配送今日出库双表;拣货 doing 同样为订单表 pick_status=padding 双表))、b2b(orders/goods/sku)、groupPicking、scatterPicking(orders/goods/sku/wave/top5)、groupPacking、scatterPacking(各含 orders/goods/sku/wave/top5,按波次范围 wave_scope 区分:团购块 top 按打包台、散单块 top 按打包员)、trend(max/total/points 业务日 24 点:label 从仓库自然日开始时间(day_start_time)起到次日自然日开始时间,每点 { label, created_count }——created_count=业务日窗口内下单量(池内待处理 + 配送表今日出库订单按订单创建时间落桶,窗口即业务日 [自然日开始时间, 次日自然日开始时间):未到次日自然日开始时间时=今日自然日开始时间起,凌晨(已过零点)时=昨日自然日开始时间起)并按小时累计(最后一点=业务日内下单总量);total=今日总单量(与 fulfillment.total 同口径:待处理订单池 + 配送表今日出库))、weeklyEfficiency(days 7 天 intercept)" } ], "errors": [],