This commit is contained in:
yin 2026-10-12 18:01:25 +08:00
parent 714a300a10
commit 1925741ada
8 changed files with 314 additions and 13 deletions

66
.tmp-stock-doc.json Normal file
View File

@ -0,0 +1,66 @@
{
"stock.warehouse.list": {
"method": "stock.warehouse.list",
"title": "仓库商品列表查询(支持 where 条件与分页)",
"description": "仓库商品列表查询(支持 where 条件与分页)",
"endpoint": "/system",
"authRequired": false,
"loginRequired": true,
"status": {
"isUsed": false,
"isPlaceholder": false
},
"headers": [
{
"name": "Authorization",
"type": "string",
"required": true,
"description": "Bearer token"
}
],
"params": [
{
"name": "pagination",
"type": "object",
"required": false,
"description": "pagination 参数"
},
{
"name": "where",
"type": "object",
"required": false,
"description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构,历史简写会在 main 中自动标准化;支持 quickWhere、barcode、prohibited_type、has_bound_item 等商品筛选字段。示例:where.barcode={operator:like,value:69}; where.prohibited_type={operator:eq,value:liquid}; where.has_bound_item={operator:eq,value:true}(已绑定外部商品)/ where.has_bound_item={operator:eq,value:false}(未绑定外部商品)。"
}
],
"response": []
},
"stock.warehouse.getInfo": {
"method": "stock.warehouse.getInfo",
"title": "查询仓库商品详情",
"description": "查询仓库商品详情",
"endpoint": "/system",
"authRequired": false,
"loginRequired": true,
"status": {
"isUsed": false,
"isPlaceholder": false
},
"headers": [
{
"name": "Authorization",
"type": "string",
"required": true,
"description": "Bearer token"
}
],
"params": [],
"response": [
{
"name": "need_recheck",
"type": "string",
"required": true,
"description": "是否需要复核:Y=需要复核,N=不需要复核"
}
]
}
}

View File

@ -560,19 +560,139 @@ export type GetWarehousePanelDataParams = {
force?: boolean | number | string
}
/** index.getWarehousePanelData 响应 */
export type GetWarehousePanelDataResponse = {
/** 是否已改变:force 为真时恒为 true;否则传入时间戳小于最后缓存时间戳时为 true,反之为 false */
is_change?: boolean
/** 服务端最后更改时间戳(Unix 秒,缓存未命中为 0),前端保存后作为下次轮询的 last_change_at 入参回传 */
last_change_at?: number
/** 面板数据,当前为空对象,字段另行约定 */
data?: Record<string, unknown>
/** index.getWarehousePanelData 响应 data.fulfillment 中的一个履约环节 */
export interface WarehousePanelFulfillmentStage {
/** 环节标识(如 receiving/shelf/pick/recheck/pack;items 末尾两项为今日退件 / 今日拆包) */
key?: string
/** 环节名称 */
name?: string
/** 未完成数量 */
undone?: number
/** 已完成数量(打包环节用订单状态存量口径,保证已复核 ≥ 已打包) */
done?: number
[key: string]: unknown
}
/** index.getWarehousePanelData 响应 data.fulfillment(订单履约链路 6 环节未/已) */
export interface WarehousePanelFulfillment {
/** 今日总单量(与 data.trend.total 同口径:待处理订单池 + 配送表今日出库) */
total?: number
/** 6 个履约环节;各环节未/已均含配送表今日出库按环节状态拆分补数 */
items?: WarehousePanelFulfillmentStage[]
[key: string]: unknown
}
/** index.getWarehousePanelData 响应 data.stageOverview.stages 中的一张阶段卡 */
export interface WarehousePanelStageCard {
/** 今日数量;pack 卡 = 今日真实打包订单数(散单任务数 + 团购波次真实订单数) */
today?: number
/** 进行中(任务数) */
doing?: number
/** 异常(任务数) */
abnormal?: number
[key: string]: unknown
}
/** index.getWarehousePanelData 响应 data.stageOverview(阶段概览 5 卡) */
export interface WarehousePanelStageOverview {
totalOrders?: number
interceptOrders?: number
/** 5 张卡:receiving / shelf / pick / recheck / pack */
stages?: WarehousePanelStageCard[] | Record<string, WarehousePanelStageCard>
[key: string]: unknown
}
/** 订单/商品/件数 统计块 */
export interface WarehousePanelVolume {
/** 订单数 */
orders?: number
/** 商品数 */
goods?: number
/** SKU 数 */
sku?: number
[key: string]: unknown
}
/** 拣货/打包区块(groupPicking / scatterPicking / groupPacking / scatterPacking) */
export interface WarehousePanelPickingBlock extends WarehousePanelVolume {
/** 波次数 */
wave?: number
/** Top5(按波次范围 wave_scope 区分:团购块按打包台、散单块按打包员) */
top5?: Array<Record<string, unknown>>
[key: string]: unknown
}
/** index.getWarehousePanelData 响应 data.trend 中的一个点位 */
export interface WarehousePanelTrendPoint {
/** 点位标签(从仓库自然日开始时间 day_start_time 起、按小时累计) */
label?: string
/** 该点位累计下单量(业务日窗口内下单量,池内待处理 + 配送表今日出库) */
created_count?: number
[key: string]: unknown
}
/** index.getWarehousePanelData 响应 data.trend(业务日 24 点下单趋势) */
export interface WarehousePanelTrend {
max?: number
/** 业务日内下单总量(与 data.fulfillment.total 同口径) */
total?: number
points?: WarehousePanelTrendPoint[]
[key: string]: unknown
}
/** index.getWarehousePanelData 响应 data.weeklyEfficiency(近 7 天拦截效率) */
export interface WarehousePanelWeeklyEfficiency {
/** 近 7 天(含各天拦截数等) */
days?: Array<Record<string, unknown>>
[key: string]: unknown
}
/**
* 仓库面板数据接口:按仓库做增量变更检测,返回 is_change 与 last_change_at。
* index.getWarehousePanelData 响应 data(面板数据对象)。
* ⚠️ `is_change=false` 时为空对象(节约流量);`is_change=true` 时按「已填充有数据源」的字段输出,
* 故所有字段均可选(无数据源的字段暂不输出)。
*/
export interface WarehousePanelData {
/** 仓库名 */
title?: string
/** 订单履约链路(6 环节未/已 + total + items 末尾两项:今日退件/今日拆包) */
fulfillment?: WarehousePanelFulfillment
/** 阶段概览 */
stageOverview?: WarehousePanelStageOverview
/** B2B(orders/goods/sku) */
b2b?: WarehousePanelVolume
/** 团购拣货(orders/goods/sku/wave/top5) */
groupPicking?: WarehousePanelPickingBlock
/** 散单拣货(orders/goods/sku/wave/top5) */
scatterPicking?: WarehousePanelPickingBlock
/** 团购打包(orders/goods/sku/wave/top5) */
groupPacking?: WarehousePanelPickingBlock
/** 散单打包(orders/goods/sku/wave/top5) */
scatterPacking?: WarehousePanelPickingBlock
/** 业务日 24 点下单趋势 */
trend?: WarehousePanelTrend
/** 近 7 天效率 */
weeklyEfficiency?: WarehousePanelWeeklyEfficiency
[key: string]: unknown
}
/** index.getWarehousePanelData 响应 */
export type GetWarehousePanelDataResponse = {
/** 是否已改变:force 为真时恒为 true;否则传入时间戳小于缓存最后时间戳时为 true,反之为 false(缓存无最后时间时恒为 true) */
is_change?: boolean
/** 服务端缓存最后更改时间戳(Unix 秒,缓存未命中为 0),前端保存后作为下次轮询的 last_change_at 入参回传 */
last_change_at?: number
/**
* 面板数据对象;`is_change=false` 时为空对象(节约流量),`is_change=true` 时按已填充字段输出。
* 字段说明见 `WarehousePanelData`
*/
data?: WarehousePanelData
}
/**
* 仓库面板数据接口:按仓库做增量变更检测,返回 is_change / last_change_at 与面板数据 data。
* ⚠️ 常规调用(force 非真)必须传 `last_change_at`;首次拉取传 `force: true`。
* ⚠️ `is_change=false` 时 `data` 为空对象,勿据此清空面板。
*/
export function getWarehousePanelData(
data?: GetWarehousePanelDataParams

View File

@ -91,6 +91,20 @@ export const RECEIVING_PENDING_INBOUND_NOTICE_TEXT_KEYS = [
'store_notice_template'
] as const
/** 站内信推送失败自动重发配置(subject_config.inbox_push_retry) */
export type SettingWarehouseInboxPushRetry = {
/** 是否开启站内信推送失败自动重发(flag:0=关闭,1=开启;默认 0=关闭,需显式开启) */
enabled?: number
/** 重发时间范围(分钟,1-1440,默认 30):仅自动重发「失败时间在该范围内」的消息;仅在 enabled 开启时生效 */
window_minutes?: number
}
/** 文档默认:inbox_push_retry 各子项默认值 */
export const DEFAULT_INBOX_PUSH_RETRY: Required<SettingWarehouseInboxPushRetry> = {
enabled: 0,
window_minutes: 30
}
/** 仓库默认发件人/地址(subject_config 内,文档默认空字符串) */
export type SettingWarehouseSenderConfig = {
sender_name?: string
@ -166,6 +180,17 @@ export type SettingWarehouseSubjectConfig = SettingWarehouseSenderConfig & {
* 仍未完成入库」的收货单:绑定货主的通知货主收货群(未配群回退仓库客服群),未绑定货主的通知仓库客服群
*/
receiving_pending_inbound_notice?: SettingWarehouseReceivingPendingInboundNotice
/**
* 自然日开始时间(业务日分界点),格式 HH:mm,默认 06:00,范围 00:00-23:59。
* 今日统计窗口为 [该时间点, 次日该时间点):当前时间早于今日该时间点时窗口从昨日该时间点开始
* (昨日该时间点后的订单视为今日);仓库面板趋势 trend 亦按此时间点分桶
*/
day_start_time?: string
/**
* 站内信推送失败自动重发配置(默认关闭)。开启后站内信回信/系统通知推送失败
* (如桥接离线返回 wx offline / qiwe offline)由定时任务每 3 分钟自动重发一次
*/
inbox_push_retry?: SettingWarehouseInboxPushRetry
[key: string]: unknown
}
@ -454,6 +479,13 @@ export function normalizeWarehouseSubjectConfig(
const cutoffTime = String(base.cutoff_order_time ?? '')
base.cutoff_order_time = HH_MM_PATTERN.test(cutoffTime) ? cutoffTime : '18:00'
// 自然日开始时间(HH:mm,默认 06:00)。⚠️ saveSettings 文档未单列该入参,
// 故仅在已带合法字符串(getSettings 响应 / 表单)时归一化,避免凭空虚增字段
const dayStartRaw = base.day_start_time
if (typeof dayStartRaw === 'string' && dayStartRaw !== '') {
base.day_start_time = HH_MM_PATTERN.test(dayStartRaw) ? dayStartRaw : '06:00'
}
// 收货未入库提醒(enabled flag 兼容 boolean / 数字 / 字符串;notice_time 非法回退 08:30;
// min_hours 默认 24;max_hours 默认 48 且必须大于 min_hours)
const noticeRaw = base.receiving_pending_inbound_notice
@ -493,6 +525,25 @@ export function normalizeWarehouseSubjectConfig(
base.receiving_pending_inbound_notice =
notice as SettingWarehouseReceivingPendingInboundNotice
// 站内信推送失败自动重发(enabled flag 0/1,默认 0;window_minutes 1-1440,默认 30)
const retryRaw = base.inbox_push_retry
const retry =
retryRaw && typeof retryRaw === 'object' && !Array.isArray(retryRaw)
? { ...(retryRaw as Record<string, unknown>) }
: ({} as Record<string, unknown>)
const retryEnabled = retry.enabled
retry.enabled =
retryEnabled === 1 || retryEnabled === '1' || retryEnabled === true ? 1 : 0
const retryWindow = Number(retry.window_minutes)
retry.window_minutes =
Number.isFinite(retryWindow) && retryWindow >= 1 && retryWindow <= 1440
? Math.trunc(retryWindow)
: DEFAULT_INBOX_PUSH_RETRY.window_minutes
base.inbox_push_retry = retry as SettingWarehouseInboxPushRetry
// 子项集合以 getFieldMeta 的 item_keys 为准(不再由前端硬编码子项 key):
// 后端给 object / array 字段改名或加子项时,只要页面把 meta 字段(含 itemFields)传进来,
// 读取与保存都会自动跟随,不会再出现「拉取的和提交的对不上」。

View File

@ -354,9 +354,26 @@ export function handleBatchDelete(data: any) {
export type HandleBatchChangeParams = {
/** 要批量修改的仓库商品记录 ID 数组(stock_warehouse.id) */
ids?: number[]
/** 要修改的字段名:brand_name、prohibited_id、gross_weight、packing_requirements、managementFlags、stock_unit、need_recheck */
/**
* 要修改的字段名(后端白名单 canChangeField):brand_name、prohibited_id、gross_weight、
* managementFlags、stock_unit、need_recheck,
* 以及与「作业要求」相关的四个字段:packing_requirements、pick_requirements、recheck_requirements、merge_requirements
*/
method?: string
/** 修改值,类型依 method 而定:brand_name/packing_requirements/stock_unit 为 string(<=255 字符);prohibited_id 为 number(整数);gross_weight 为 number(正整数,单位 g);managementFlags 为 object(含 is_sn_mgmt/is_shelf_life_mgmt/is_batch_mgmt,值为 Y/N);need_recheck 为 string(仅支持 Y/N) */
/**
* 修改值,类型依 method 而定:
* - brand_name/stock_unit:string(<=255 字符)
* - 作业要求三字段 packing_requirements / pick_requirements / recheck_requirements:string(<=255 字符)
* - merge_requirements(是否合并):string,仅支持 'Y'(合并)/ 'N'(拆分)
* - prohibited_id:number(整数)
* - gross_weight:number(正整数,单位 g)
* - managementFlags:object(含 is_sn_mgmt/is_shelf_life_mgmt/is_batch_mgmt,值为 Y/N)
* - need_recheck:string(仅支持 Y/N)
*
* ⚠️ 单次请求只改 method 指定的一个字段(一次只传一个字段,不支持多字段批量)。
* ⚠️ 待确认:`merge_requirements=Y` 时后端是否会联动清空 pick/recheck_requirements;
* 若不联动,前端需在改「是否合并」后另行下发清空(当前实现按「后端自行处理」处理,未额外下发)。
*/
value?: string | number | Record<string, any>
/** 兼容字段:当前实现以 value 为准,不使用 values */
values?: any

View File

@ -248,6 +248,12 @@ export interface StorePolicyConfigPayload {
cutoff_order_time?: string
/** 开始自动分配时间,格式 HH:mm,默认 08:00,范围 00:00-23:59 */
allocate_start_time?: string
/**
* 自然日开始时间(业务日分界点),格式 HH:mm,默认 06:00,范围 00:00-23:59。
* ⚠️ `getPolicyConfigFields` 已返回该字段元信息(本批新增);`savePolicyConfig` 文档未单列,
* 但 policy_config 为自由对象,按元信息提交即可
*/
day_start_time?: string
[key: string]: unknown
}

View File

@ -41,6 +41,9 @@
<el-dropdown-item command="prohibited_id">违禁品类型</el-dropdown-item>
<el-dropdown-item command="gross_weight">毛重</el-dropdown-item>
<el-dropdown-item command="packing_requirements">打包要求</el-dropdown-item>
<el-dropdown-item command="pick_requirements">拣货要求</el-dropdown-item>
<el-dropdown-item command="recheck_requirements">复核要求</el-dropdown-item>
<el-dropdown-item command="merge_requirements">是否合并</el-dropdown-item>
<el-dropdown-item command="managementFlags">管理标识</el-dropdown-item>
</el-dropdown-menu>
</template>
@ -292,7 +295,7 @@ const showBatchDialog = ref(false)
const batchDialogOptions = ref<any[]>([])
const batchDialogValue = ref<any>(null)
const batchDialogCommand = ref('')
const BATCH_SELECT_COMMANDS = new Set(['stock_unit', 'prohibited_id'])
const BATCH_SELECT_COMMANDS = new Set(['stock_unit', 'prohibited_id', 'merge_requirements'])
const importFileInputRef = ref<HTMLInputElement | null>(null)
type ProhibitedOption = { value: number; label: string }
@ -703,12 +706,21 @@ const handleBatchChange = async (command: string) => {
ElMessage.warning('批量修改管理标识暂未迁移')
return
} else {
const maxlength: number | undefined = config.maxlength
const { value: inputValue } = await ElMessageBox.prompt(`请输入${config.title}`, `批量修改${config.title}`, {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: config.type === 'number' ? /^-?\d+(\.\d+)?$/ : undefined,
inputErrorMessage: config.type === 'number' ? '请输入有效的数字' : undefined,
inputPlaceholder: config.placeholder
inputPlaceholder: config.placeholder,
// 作业要求类文本字段:非空 + 长度上限(后端 handleBatchChange 白名单限制 ≤255 字符)
inputValidator: (val: string) => {
if (config.type === 'number') return true
const text = String(val ?? '')
if (!text.trim()) return `${config.title}不能为空`
if (maxlength && text.length > maxlength) return `${config.title}最多 ${maxlength} 个字符`
return true
}
})
value = inputValue
}

View File

@ -491,9 +491,37 @@ export const stockBatchConfig = {
packing_requirements: {
title: '打包要求',
placeholder: '请输入打包要求',
// 后端 handleBatchChange 白名单:字符串,≤255 字符
maxlength: 255,
validator: (value: any) => value && value.trim().length > 0,
errorMessage: '打包要求不能为空'
},
pick_requirements: {
title: '拣货要求',
placeholder: '请输入拣货要求',
// 后端 handleBatchChange 白名单(拆分后独立字段):字符串,≤255 字符
maxlength: 255,
validator: (value: any) => value && value.trim().length > 0,
errorMessage: '拣货要求不能为空'
},
recheck_requirements: {
title: '复核要求',
placeholder: '请输入复核要求',
// 后端 handleBatchChange 白名单(拆分后独立字段):字符串,≤255 字符
maxlength: 255,
validator: (value: any) => value && value.trim().length > 0,
errorMessage: '复核要求不能为空'
},
merge_requirements: {
// 是否合并:Y=合并(只输出打包要求,所有接口输出该商品的打包要求)/ N=拆分(打包/拣货/复核要求各自独立)
title: '是否合并',
placeholder: '请选择是否合并',
type: 'select',
options: [
{ label: '合并', value: 'Y' },
{ label: '拆分', value: 'N' }
]
},
managementFlags: {
title: '管理标识',
type: 'checkbox',

View File

@ -286,6 +286,7 @@ const FALLBACK_FIELDS: NormalizedField[] = [
},
{ key: 'allocate_start_time', label: '开始自动分配时间', type: 'string', maxLength: 5, default: '08:00', description: '格式 HH:mm,默认 08:00,范围 00:00-23:59;早于该时间的订单与超过截单时间行为一致,不自动分配快递和储位、不自动加团' },
{ key: 'cutoff_order_time', label: '截单时间', type: 'string', maxLength: 5, default: '18:00', description: '格式 HH:mm,默认 18:00,范围 00:00-23:59;作为最后允许自动分配的时间,开始时间晚于截单时间时截单时间视为次日(跨天窗口)' },
{ key: 'day_start_time', label: '自然日开始时间', type: 'string', maxLength: 5, default: '06:00', description: '格式 HH:mm,默认 06:00,范围 00:00-23:59;业务日分界点,今日统计窗口为 [该时间点, 次日该时间点),当前时间早于今日该时间点时窗口从昨日该时间点开始' },
{ key: 'sender_name', label: '默认发件人姓名', type: 'string', maxLength: 50 },
{ key: 'sender_tel', label: '默认发件人联系电话', type: 'string', maxLength: 20 },
{ key: 'province_name', label: '默认发件省份', type: 'string', maxLength: 50 },