diff --git a/dist.tar.gz b/dist.tar.gz index 376b4056..2a4e5c5d 100644 Binary files a/dist.tar.gz and b/dist.tar.gz differ diff --git a/src/api/stock.ts b/src/api/stock.ts index facb66b6..df697f87 100644 --- a/src/api/stock.ts +++ b/src/api/stock.ts @@ -340,17 +340,22 @@ export function getStockDetail(stock_id: number, pagination?: { page: number; pa } as any) } -// 已弃用 -// export function warehouseSearch(data:any) { -// return request({ -// url: '/system', -// method: 'post', -// params: { -// method: 'stock.warehouse.search', -// v, -// timestamp: new Date().getTime() -// }, -// data: data, -// isSystemApi: true -// } as any) -// } \ No newline at end of file +// PDA使用,本项目不使用 +export function warehouseSearch(data: { + keyword?: string + store_id?: number + with_stock?: boolean + is_batch?: boolean +}) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'stock.warehouse.search', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} \ No newline at end of file diff --git a/src/api/storage/entry.ts b/src/api/storage/entry.ts index d4ab9806..88b3e874 100644 --- a/src/api/storage/entry.ts +++ b/src/api/storage/entry.ts @@ -28,58 +28,6 @@ export function getEntryDetail(data:any): Promise { }) } -export function createEntry(data:any): Promise { - return request({ - url: '/system', - method: 'post', - params: { - method: 'storage.entry.create', - v, - timestamp: new Date().getTime() - }, - data: data - }) -} - -export function addDetail(data:any): Promise { - return request({ - url: '/system', - method: 'post', - params: { - method: 'storage.entry.addDetail', - v, - timestamp: new Date().getTime() - }, - data: data - }) -} - -export function deleteDetail(data:any): Promise { - return request({ - url: '/system', - method: 'post', - params: { - method: 'storage.entry.deleteDetail', - v, - timestamp: new Date().getTime() - }, - data: data - }) -} - -export function detailChange(data:any): Promise { - return request({ - url: '/system', - method: 'post', - params: { - method: 'storage.entry.detailChange', - v, - timestamp: new Date().getTime() - }, - data: data - }) -} - export function cancelEntry(data:any): Promise { return request({ url: '/system', @@ -104,4 +52,21 @@ export function completeEntry(data:any): Promise { }, data: data }) +} + +// 废弃接口,不再使用 +export function createEntry(data:any): Promise { + return Promise.reject(new Error('storage.entry.create 已下线,请使用 quickPutaway / matchPutaway 流程')) +} + +export function addDetail(data:any): Promise { + return Promise.reject(new Error('storage.entry.addDetail 已下线,入库单明细不再对外编辑')) +} + +export function deleteDetail(data:any): Promise { + return Promise.reject(new Error('storage.entry.deleteDetail 已下线,入库单明细不再对外编辑')) +} + +export function detailChange(data:any): Promise { + return Promise.reject(new Error('storage.entry.detailChange 已下线,入库单明细不再对外编辑')) } \ No newline at end of file diff --git a/src/api/storage/inventory.ts b/src/api/storage/inventory.ts index 06a71584..226ef3a8 100644 --- a/src/api/storage/inventory.ts +++ b/src/api/storage/inventory.ts @@ -2,29 +2,6 @@ import request from '@/utils/request' const v = "1.0" -/** - * 收货单快捷入库上架 - * 从收货单直接生成入库单(SCRK)并写入库存,同时更新库存数量。 - * 要求收货单已完成且所有明细已匹配系统商品。 - */ -export function quickPutaway(data: { - /** 收货单ID */ - receiving_id: number - /** 可选:指定目标仓库货位等附加信息 */ - extra?: Record -}): Promise { - return request({ - url: '/system', - method: 'post', - params: { - method: 'storage.inventory.quickPutaway', - v, - timestamp: new Date().getTime() - }, - data, - isSystemApi: true - } as any) -} export function getInventoryList(data: any): Promise { return request({ @@ -38,4 +15,41 @@ export function getInventoryList(data: any): Promise { data, isSystemApi: true } as any) +} + + +// 非本项目接口,不使用 +export function matchPutaway(data: { + receiving_id: number + extra?: Record +}): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'storage.inventory.matchPutaway', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} +export function transferByProduct(data: { + space_id: number + stock_id: number + target_space_id: number + quantity: number +}): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'storage.inventory.transferByProduct', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) } \ No newline at end of file diff --git a/src/api/storage/receiving.ts b/src/api/storage/receiving.ts index 29b68a1e..b01b93ce 100644 --- a/src/api/storage/receiving.ts +++ b/src/api/storage/receiving.ts @@ -255,4 +255,24 @@ export function bindDetailProduct(data: any): Promise { }, data: data, }) +} + + +export function quickPutaway(data: { + /** 收货单ID */ + receiving_id: number + /** 可选:指定目标仓库货位等附加信息 */ + extra?: Record +}): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'storage.inventory.quickPutaway', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) } \ No newline at end of file diff --git a/src/api/storage/stockout.ts b/src/api/storage/stockout.ts index 3bbf07c6..89769cfb 100644 --- a/src/api/storage/stockout.ts +++ b/src/api/storage/stockout.ts @@ -12,4 +12,21 @@ export const stockoutList = (data: any) => { }, data: data }) +} + +export const stockoutListItems = (data: { + delivery_order_code?: string + order_id?: number + id?: number +}) => { + return request({ + url: `/system`, + method: 'post', + params: { + method: 'storage.stockout.listItems', + v, + timestamp: new Date().getTime() + }, + data: data + }) } \ No newline at end of file diff --git a/src/components/ScanBox/index.vue b/src/components/ScanBox/index.vue index d42a69ce..118c017a 100644 --- a/src/components/ScanBox/index.vue +++ b/src/components/ScanBox/index.vue @@ -42,7 +42,7 @@ placeholder="条件类型" size="small" class="operator-select" - @change="handleTextOperatorChange(field)" + @change="handleOperatorChange(field)" > + 无需填值 + + 无需填值 + + + + + + 无需填值 + + - +
{{ field.label }} @@ -362,9 +416,16 @@ const props = defineProps({ text: [ { value: 'eq', label: '等于' }, { value: 'ne', label: '不等于' }, + { value: 'like', label: '模糊匹配' }, { value: 'contains', label: '包含' }, { value: 'startswith', label: '开头为' }, - { value: 'endswith', label: '结尾为' } + { value: 'endswith', label: '结尾为' }, + { value: 'in', label: 'IN(逗号分隔)' }, + { value: 'notin', label: 'NOT IN' }, + { value: 'isnull', label: '为空' }, + { value: 'isnotnull', label: '不为空' }, + { value: 'regexp', label: '正则匹配' }, + { value: 'notregexp', label: '正则不匹配' } ], number: [ { value: 'eq', label: '等于' }, @@ -373,13 +434,27 @@ const props = defineProps({ { value: 'lt', label: '小于' }, { value: 'ge', label: '大于等于' }, { value: 'le', label: '小于等于' }, - { value: 'between', label: '包含' } + { value: 'between', label: '区间内' }, + { value: 'notbetween', label: '区间外' }, + { value: 'in', label: 'IN(逗号分隔)' }, + { value: 'notin', label: 'NOT IN' }, + { value: 'isnull', label: '为空' }, + { value: 'isnotnull', label: '不为空' } ], date: [ { value: 'eq', label: '等于' }, { value: 'ne', label: '不等于' }, { value: 'gt', label: '晚于' }, - { value: 'lt', label: '早于' } + { value: 'lt', label: '早于' }, + { value: 'ge', label: '大于等于' }, + { value: 'le', label: '小于等于' }, + { value: 'between', label: '区间内' }, + { value: 'notbetween', label: '区间外' }, + { value: 'isnull', label: '为空' }, + { value: 'isnotnull', label: '不为空' } + ], + daterange: [ + { value: 'between', label: '区间' } ] }) }, @@ -451,28 +526,52 @@ onBeforeUnmount(() => { }) // Methods +// 操作符类型辅助函数 +function isNullishOperator(op: string) { + return ['isnull', 'isnotnull'].includes(op) +} +function isRangeOperator(op: string) { + return ['between', 'notbetween'].includes(op) +} +function isMultiOperator(op: string) { + return ['in', 'notin'].includes(op) +} + function getTextPlaceholder(field: any) { const operator = customConditions[field.value].operator const basePlaceholder = field.placeholder || `请输入${field.label}` - if (operator === 'contains') { + if (operator === 'contains' || operator === 'in' || operator === 'notin') { return `${basePlaceholder}(多个值用逗号分隔)` } return basePlaceholder } -function handleTextOperatorChange(field: any) { +// 统一的操作符切换处理函数 +function handleOperatorChange(field: any) { const operator = customConditions[field.value].operator - if (operator !== 'contains') { + // 切换至非多值操作符时,如果当前值是数组则转为逗号字符串 + if (!['contains', 'in', 'notin'].includes(operator)) { const currentValue = customConditions[field.value].value if (Array.isArray(currentValue)) { customConditions[field.value].value = currentValue.join(', ') } } + // 切换至 isnull/isnotnull 时清空值 + if (isNullishOperator(operator)) { + customConditions[field.value].value = undefined + customConditions[field.value].valueMin = undefined + customConditions[field.value].valueMax = undefined + } handleCustomChange() } +// 升级兼容:保留旧名称供内部历史调用 +function handleTextOperatorChange(field: any) { + handleOperatorChange(field) +} + function normalizeTextValue(field: any) { const operator = customConditions[field.value].operator const value = customConditions[field.value].value @@ -496,7 +595,7 @@ function normalizeTextValue(field: any) { function initCustomConditions(fields: any[]) { fields.forEach(field => { - let defaultValue = undefined + let defaultValue: any = undefined let defaultOperator = '' switch (field.type) { @@ -509,29 +608,36 @@ function initCustomConditions(fields: any[]) { break case 'daterange': defaultValue = [] + defaultOperator = 'between' // daterange 固定使用 between break default: defaultValue = undefined } - if (field.operators && Array.isArray(field.operators) && field.operators.length > 0) { - defaultOperator = field.defaultOperator || field.operators[0] - } else { - const defaultOps = props.defaultOperators[field.type as keyof typeof props.defaultOperators] - if (defaultOps && defaultOps.length > 0) { - defaultOperator = field.defaultOperator || defaultOps[0].value || '' + // daterange 已在上面 switch 设置了 defaultOperator,其他类型按字段配置或默认列表确定 + if (field.type !== 'daterange') { + if (field.operators && Array.isArray(field.operators) && field.operators.length > 0) { + defaultOperator = field.defaultOperator || field.operators[0] + } else { + const defaultOps = props.defaultOperators[field.type as keyof typeof props.defaultOperators] + if (defaultOps && defaultOps.length > 0) { + defaultOperator = field.defaultOperator || defaultOps[0].value || '' + } } } - // Assign to reactive object - // Using Object.assign or direct assignment for existing properties to maintain reactivity if needed, - // but here we are initializing/resetting so direct assignment is fine, but we need to ensure reactivity. - // Since customConditions is reactive({}), adding new properties works. if (!customConditions[field.value]) { - customConditions[field.value] = { value: defaultValue, operator: defaultOperator } + customConditions[field.value] = { + value: defaultValue, + operator: defaultOperator, + valueMin: undefined, + valueMax: undefined + } } else { - customConditions[field.value].value = defaultValue - customConditions[field.value].operator = defaultOperator + customConditions[field.value].value = defaultValue + customConditions[field.value].operator = defaultOperator + customConditions[field.value].valueMin = undefined + customConditions[field.value].valueMax = undefined } }) } @@ -602,15 +708,50 @@ function buildAndEmitCustomCondition() { props.availableFields.forEach((field: any) => { const condition = customConditions[field.value] + const op = condition.operator + + // isnull / isnotnull: 无需值,直接包含 + if (isNullishOperator(op)) { + conditions[field.value] = { + value: null, + operator: op, + field: field.value, + type: field.type + } + hasCondition = true + return + } + + // between / notbetween 对 number 类型:使用 valueMin/valueMax + if (field.type === 'number' && isRangeOperator(op)) { + const min = condition.valueMin + const max = condition.valueMax + if (min !== undefined && min !== null && max !== undefined && max !== null) { + conditions[field.value] = { + value: [min, max], + operator: op, + field: field.value, + type: 'number' + } + hasCondition = true + } + return + } + let conditionValue = condition.value - if (field.type === 'text' && condition.operator === 'contains' && conditionValue) { - const values = conditionValue.split(',').filter((v: string) => v.trim()) + // 处理多值操作符:contains / in / notin 逗号分隔 -> 数组 + if (['contains', 'in', 'notin'].includes(op) && typeof conditionValue === 'string' && conditionValue) { + const values = conditionValue.split(',').map((v: string) => v.trim()).filter(Boolean) if (values.length > 0) { conditionValue = values } } + // daterange 固定 operator = between + const finalOp = field.type === 'daterange' ? 'between' : op + const finalType = field.type === 'daterange' ? 'daterange' : field.type + if (conditionValue !== undefined && conditionValue !== null && conditionValue !== '' && @@ -618,9 +759,9 @@ function buildAndEmitCustomCondition() { conditions[field.value] = { value: conditionValue, - operator: condition.operator, + operator: finalOp, field: field.value, - type: field.type, + type: finalType, isMultiple: Array.isArray(conditionValue) } hasCondition = true @@ -730,20 +871,51 @@ function buildConditionsObject() { const conditions: any = {} props.availableFields.forEach((field: any) => { const condition = customConditions[field.value] + const op = condition.operator + + // isnull / isnotnull + if (isNullishOperator(op)) { + conditions[field.value] = { + value: null, + operator: op, + type: field.type + } + return + } + + // between / notbetween 对 number + if (field.type === 'number' && isRangeOperator(op)) { + const min = condition.valueMin + const max = condition.valueMax + if (min !== undefined && min !== null && max !== undefined && max !== null) { + conditions[field.value] = { + value: [min, max], + operator: op, + type: 'number' + } + } + return + } + let conditionValue = condition.value - if (field.type === 'text' && condition.operator === 'contains' && conditionValue) { - const values = conditionValue.split(',').filter((v: string) => v.trim()) - if (values.length > 0) { - conditionValue = values - } + if (['contains', 'in', 'notin'].includes(op) && typeof conditionValue === 'string' && conditionValue) { + const values = conditionValue.split(',').map((v: string) => v.trim()).filter(Boolean) + if (values.length > 0) conditionValue = values } + const finalOp = field.type === 'daterange' ? 'between' : op + const finalType = field.type === 'daterange' ? 'daterange' : field.type + if (conditionValue !== undefined && conditionValue !== null && conditionValue !== '' && !(Array.isArray(conditionValue) && conditionValue.length === 0)) { - conditions[field.value] = conditionValue + conditions[field.value] = { + value: conditionValue, + operator: finalOp, + type: finalType + } } }) return conditions @@ -968,4 +1140,28 @@ defineExpose({ getConditions, reset, clear }) .reset-btn { color: #666; } + +/* 区间双输入样式 */ +.range-input { + flex: 1; + min-width: 0; +} + +.range-sep { + flex-shrink: 0; + line-height: 28px; + font-size: 12px; + color: #909399; + padding: 0 2px; +} + +/* isnull/isnotnull 无需填值提示 */ +.no-value-tip { + flex: 1; + font-size: 12px; + color: #c0c4cc; + line-height: 28px; + padding-left: 4px; + font-style: italic; +} diff --git a/src/test.txt b/src/test.txt index a8de5a30..3b7a1c2b 100644 --- a/src/test.txt +++ b/src/test.txt @@ -1,160 +1,5 @@ 接口文档更新: [ - { - "version": "2026.04.07-system-01", - "date": "2026-04-07", - "summary": "修正 warehouse.getAreaRacks 的鉴权/权限链路文档,明确该接口需要登录并走权限校验。", - "methods": [ - "warehouse.getAreaRacks" - ], - "notes": [ - "对齐当前 system 文档中的 isNeedAuth=true、isNeedLogin=true。", - "用于补充该接口权限链路修正文档的历史上下文,不改变 methods/system.json 的 SSOT 角色。" - ] - }, - { - "version": "2026.04.07-system-02", - "date": "2026-04-07", - "summary": "补充签约配置相关接口文档,覆盖策略字段元信息查询与面单数量人工调整。", - "methods": [ - "storeWarehouse.store.getPolicyConfigFields", - "storeWarehouse.store.adjustPrintQuantity" - ], - "notes": [ - "getPolicyConfigFields 说明为获取签约策略可配置字段元信息列表。", - "adjustPrintQuantity 说明为人工调整签约关系下的面单余额并记录变更日志,并明确 id、change_quantity、reason 等关键入参。" - ] - }, - { - "version": "2026.04.07-system-03", - "date": "2026-04-07", - "summary": "对外命名从 qimenConfig 收口为 apiConfig,并在接口配置文档中强调 interface_type_id 校验。", - "methods": [ - "storeWarehouse.store.listApiConfig", - "storeWarehouse.store.saveApiConfig", - "storeWarehouse.store.deleteQimenConfig" - ], - "notes": [ - "文档对外统一使用 apiConfig / api_config 命名,减少 qimenConfig 历史别名歧义。", - "saveApiConfig 要求 interface_type_id 为必填且必须指向已存在的 wms_interface_type 记录。", - "listApiConfig / deleteQimenConfig 同步补充 interface_type_id 字段说明。" - ] - }, - { - "version": "2026.04.07-system-04", - "date": "2026-04-07", - "summary": "补充 /api/docs 文档体验增强说明,新增查看变更记录与查看原文 JSON 的入口说明。", - "methods": [ - "/api/docs", - "/api/docs/:docName", - "/api/docs/:docName/raw", - "/api/docs/:docName/changes" - ], - "notes": [ - "sidecar 变更数组用于承载文档历史说明,不替代 methods/system.json 作为 SSOT。", - "原文 JSON 入口继续用于直接查看当前生效文档。" - ] - }, - { - "version": "2026.04.07-system-05", - "date": "2026-04-07", - "summary": "修正 storeWarehouse.store.adjustPrintQuantity 的面单余额调整语义:由增减/累加改为覆盖设置目标余额。", - "methods": [ - "storeWarehouse.store.adjustPrintQuantity" - ], - "notes": [ - "adjustPrintQuantity 当前兼容 print_quantity、target_quantity、change_quantity、adjust_quantity 作为目标面单余额输入,不再按增减量解释。", - "变更日志中的 change_quantity 由 before/after 自动计算差值,以兼容历史审计与展示。" - ] - }, - { - "id": "2026.04.07-system-06", - "date": "2026-04-07", - "method": "storeWarehouse.store.saveApiConfig", - "type": "changed", - "summary": "按接口类型分类限制必填字段,OPEN_API 创建时自动生成 self_app_key/self_app_secret", - "detail": "QM_WMS 类型须填写 qimen_app_key/qimen_customer_id/qimen_warehouse_code;OPEN_API 类型三个奇门字段非必填,创建时自动生成 self_app_key(WMS+32位HEX)和 self_app_secret(64位HEX),更新时保留已有密钥。" - }, - { - "id": "2026.04.07-system-07", - "date": "2026-04-07", - "method": "index.listInterfaceTypes", - "type": "added", - "summary": "新增接口类型列表查询接口,归属基础模块,无需权限", - "detail": "返回所有已启用的接口类型(wms_interface_type),包含 id、interface_code、interface_name、interface_category、description 字段。设置 isNeedAuth: false, isNeedLogin: true。" - }, - { - "id": "2026.04.07-system-08", - "date": "2026-04-07", - "method": "storeWarehouse.store.saveApiConfig", - "type": "changed", - "summary": "app_name 改为必传参数", - "detail": "app_name 不再有默认值自动生成逻辑,调用方必须传入非空的 app_name,否则返回 400 错误。" - }, - { - "id": "2026.04.07-system-09", - "date": "2026-04-07", - "method": "storage.inventory.quickPutaway", - "type": "added", - "summary": "新增收货单快捷入库上架接口", - "detail": "新建 storage.inventory 库存操作模块。quickPutaway 从收货单直接生成入库单(SCRK)并写入 wms_storage 库存表,同时更新 wms_stock_warehouse 库存数量(悲观行锁),回填收货明细入库状态。要求收货单已完成且所有明细已匹配系统商品。" - }, - { - "id": "2026.04.08-system-01", - "date": "2026-04-08", - "method": "storage.inventory.matchPutaway", - "type": "added", - "summary": "新增收货单与入库单匹配入库接口", - "detail": "接收多个收货单和入库单,按商品(stock_warehouse_id)进行数量匹配入库,完成后根据入库单来源(QM/API)自动触发回传。入参为 receiving_ids(数组)和 entry_order_ids(数组),返回匹配汇总、各收货单入库状态、各入库单状态及回传结果。isNeedAuth=true, isNeedLogin=true, isNeedRight=false。" - }, - { - "id": "2026.04.08-system-02", - "date": "2026-04-08", - "method": "storeWarehouse.store.saveApiConfig", - "type": "changed", - "summary": "saveApiConfig 新增 callback_url 可选参数", - "detail": "新增 callback_url 参数(VARCHAR(500),可选),用于 OPEN_API 类型入库单的回调地址配置。" - }, - { - "id": "2026.04.08-system-03", - "date": "2026-04-08", - "method": "storeWarehouse.store.list, storeWarehouse.store.listApiConfig", - "type": "changed", - "summary": "serializeQimenConfig 新增返回 callback_url 字段,影响 list 和 listApiConfig 两个接口", - "detail": "serializeQimenConfig() 序列化方法新增 callback_url(string)字段。storeWarehouse.store.list 返回的每条记录 api_config 对象中包含 callback_url;storeWarehouse.store.listApiConfig 返回的 list 数组中每条配置包含 callback_url。" - }, - { - "id": "2026.04.08-system-04", - "date": "2026-04-08", - "method": "storage.inventory.transferLocation", - "type": "added", - "summary": "新增库存移库(库位转移)接口", - "detail": "新增 storage.inventory.transferLocation 接口,支持批量多商品多库位移库,包含部分数量移库与全量移库。入参为 warehouse_id(仓库ID)和 transfers 数组(storage_id、target_space_id、quantity),触发 storage_transfer_completed 通知事件,每条移库记录独立操作日志。isNeedAuth=true, isNeedLogin=true。" - }, - { - "id": "2026.04.08-system-05", - "date": "2026-04-08", - "method": "storage.inventory.transferLocation", - "type": "modified", - "summary": "简化移库接口入参,从批量 transfers 数组改为单条移库", - "detail": "移除 warehouse_id 和 transfers 数组入参,改为扁平的 storage_id + target_space_id + quantity 三个顶层参数。warehouse_id 从库存记录自动获取,接口从批量移库简化为单商品单库位移库。响应结构同步简化为单条结果对象。" - }, - { - "id": "2026.04.08-system-06", - "date": "2026-04-08", - "method": "stock.warehouse.getStockDetail", - "type": "added", - "summary": "新增商品库存明细查询接口", - "detail": "新增 stock.warehouse.getStockDetail 接口,按库位/批次维度查询商品库存分布。入参为 stock_id(必填,商品库存ID)和 pagination(可选,含 page/pageSize)。返回 stockItem(商品概要)、storageList(wms_storage 明细数组,含批次号、库位、数量、锁定数量、生产日期、过期日期等,关联 location_space 库位信息)、pagination 分页信息。isNeedAuth=false, isNeedLogin=true。底层调用 stockStore.getStockDetail,自动校验商品归属当前仓库。" - }, - { - "id": "2026.04.08-system-07", - "date": "2026-04-08", - "method": "stock.warehouse.getStockDetail", - "type": "modified", - "summary": "新增入参 group_by_batch,支持按批次维度切换库存明细聚合方式", - "detail": "新增可选布尔参数 group_by_batch(默认 false)。false 时按库位合并数量,批次相关字段(batch_no, production_date, expiry_date, inbound_time, inbound_order_no, supplier_batch_no)置 null;true 时保持原逻辑返回每条明细。出参结构不变,但 storageList 中批次字段在合并模式下为 null。" - }, { "id": "2026.04.08-system-08", "date": "2026-04-08", @@ -163,4 +8,113 @@ "summary": "新增按商品维度移库接口", "detail": "新增 storage.inventory.transferByProduct 接口,按库位+商品查找所有库存记录合并移动。入参为 space_id(原库位ID)、stock_id(商品SKU ID,即 wms_stock_warehouse.id)、target_space_id(目标库位ID)、quantity(移库数量)。开启批次管理(is_batch_mgmt=Y)的商品会被拒绝,需使用 transferLocation 按库存记录精确移库。复用 storage_transfer_completed 通知事件,操作日志编码 STORAGE_TRANSFER_BY_PRODUCT。isNeedAuth=true, isNeedLogin=true。" } + { + "id": "2026.04.08-system-09", + "date": "2026-04-08", + "method": "storeWarehouse.store.list", + "type": "updated", + "summary": "补充 storeWarehouse.store.list 完整 response 输出字段说明,移除 api_config / apiConfig", + "detail": "从返回结果中移除 api_config 和 apiConfig 字段(代码中 delete serialized.api_config / delete serialized.apiConfig),文档 response 补充完整输出字段列表:id, store_id, store_name, warehouse_id, warehouse_name, counterparty_id, counterparty_name, current_subject_role, auth_status, auth_status_label, apply_reason, review_comment, apply_time, review_time, auth_start, auth_end, actual_end, print_quantity, applied_by, reviewed_by, ended_by, remask, use_status, policy_config, is_auth_valid, remaining_days 以及分页和 current_subject 信息。" + }, + { + "id": "2026.04.08-system-10", + "date": "2026-04-08", + "method": "storeWarehouse.store.list", + "type": "changed", + "summary": "货主列表返回新增 has_qimen_config 布尔字段", + "detail": "storeWarehouse.store.list 返回的 data.list[] 中新增 has_qimen_config(boolean),表示该货主是否已配置奇门。" + }, + { + "id": "2026.04.08-system-11", + "date": "2026-04-08", + "method": "stock.warehouse.search", + "type": "updated", + "summary": "补全 stock.warehouse.search 接口文档,新增 params / response / errors 完整说明", + "detail": "入参补充 keyword(string,模糊匹配 item_code / item_name / goods_code / barcode)和 store_id(number,按货主筛选)。响应补充 data 数组各字段(id, item_code, goods_code, item_name, sku_property, stock_unit, quantity, locked_quantity, brand_name, item_type, barcodes, store_stock)以及 total。errors 补充 code=0 搜索失败场景。" + }, + { + "id": "2026.04.08-system-12", + "date": "2026-04-08", + "method": "stock.warehouse.search", + "type": "updated", + "summary": "新增 with_stock / is_batch 参数,支持返回关联库存明细(按库位分组或按批次逐条)", + "detail": "入参新增 with_stock(boolean,默认 false,是否返回关联库存数据)和 is_batch(boolean,默认 false,仅 with_stock=true 时生效,按批次明细返回)。响应 data[] 新增 storage[] 字段:is_batch=false 时按库位分组汇总(含 space_id、space、inventory_type、quantity、locked_quantity、available_quantity);is_batch=true 时逐条返回批次明细(含 id、stock_id、space_id、batch_no、inventory_type、quantity、locked_quantity、available_quantity、production_date、expiry_date、inbound_time、inbound_order_no、supplier_batch_no、created_at、space)。" + }, + { + "id": "2026.04.08-system-13", + "date": "2026-04-08", + "method": "wms_stock_transaction", + "type": "added", + "summary": "新增 wms_stock_transaction 表和模型", + "detail": "新增出入库流水记录表 wms_stock_transaction,含 transaction_type(INBOUND/OUTBOUND)、warehouse_id、store_id、stock_id、storage_id、space_id、quantity、batch_no、inventory_type、order_type、order_no、order_id、receiving_id、entry_order_id、operator_id、operator_name、remark 等字段,关联 StockWarehouse 和 Storage 模型。" + }, + { + "id": "2026.04.08-system-14", + "date": "2026-04-08", + "method": "storage.inventory.quickPutaway,storage.inventory.matchPutaway", + "type": "updated", + "summary": "quickPutaway 和 matchPutaway 入库时自动写入出入库记录", + "detail": "入库操作完成后自动写入 wms_stock_transaction 记录。quickPutaway 写入 order_type='SCRK'(收货入库),matchPutaway 写入 order_type='MATCH'(匹配入库),均自动填充 warehouse_id、store_id、stock_id、storage_id、space_id、quantity、batch_no、inventory_type 等字段。" + }, + { + "id": "2026.04.08-system-15", + "date": "2026-04-08", + "method": "storage.inventory.list", + "type": "added", + "summary": "新增 storage.inventory.list 出入库记录列表查询接口", + "detail": "出入库记录列表查询,支持 where 条件(transaction_type、stock_id、space_id、store_id、order_type、order_no、inventory_type、operator_name、created_at)、分页(pagination)、排序(sort)和 group_by_batch 参数。默认合并模式按库位+商品聚合返回合计数量与记录条数,group_by_batch=true 时返回每条明细含 batch_no、order_no、operator_name 等完整信息。响应均关联 stockItem(item_code、item_name、sku_property、stock_unit)。" + }, + { + "id": "2026.04.08-system-16", + "date": "2026-04-08", + "module": "storage", + "method": "storage.transaction.list", + "type": "rename", + "summary": "出入库流水记录查询接口从 storage.inventory.list 改名为 storage.transaction.list", + "detail": "将出入库流水记录查询从 storage.inventory.list 迁移到 storage.transaction.list,避免与库存列表概念混淆。功能和参数不变。isNeedAuth=false, isNeedLogin=true, isNeedRight=false。" + }, + { + "id": "2026.04.08-system-17", + "date": "2026-04-08", + "module": "storage", + "method": "storage.inventory.list", + "type": "add", + "summary": "新增 storage.inventory.list 库存列表查询接口", + "detail": "新增库存列表查询接口,查询 wms_storage 表。支持 where 条件(stock_id/space_id/store_id/inventory_type/batch_no/inbound_order_no/available_quantity/inbound_time/created_at)、分页、排序。支持 group_by_batch 参数:默认 false 按库位+商品合并(SUM quantity/locked_quantity/available_quantity),true 返回每条明细含 batch_no/production_date/expiry_date 等。关联 stockItem(商品信息)和 space(库位信息)。isNeedAuth=false, isNeedLogin=true, isNeedRight=false。" + }, + { + "id": "2026.04.08-system-18", + "date": "2026-04-08", + "module": "storage", + "method": "storage.entry.create", + "type": "remove", + "summary": "移除 storage.entry.create 创建入库单接口", + "detail": "不再允许通过 API 创建入库单。入库单仅由快捷入库(quickPutaway)和匹配入库(matchPutaway)等内部流程自动创建。底层 service 实现保留但不再通过 systemMethods 暴露。" + }, + { + "id": "2026.04.08-system-19", + "date": "2026-04-08", + "module": "storage", + "method": "storage.entry.addDetail, storage.entry.deleteDetail, storage.entry.detailChange", + "type": "remove", + "summary": "移除 storage.entry.addDetail / deleteDetail / detailChange 对外接口", + "detail": "入库单明细编辑能力不再通过 systemMethods 对外暴露,入库单模块仅保留 list/get/cancel/completeEntry。" + }, + { + "id": "2026.04.08-system-20", + "date": "2026-04-08", + "module": "storage", + "method": "storage.stockout.list, storage.stockout.toOrder, storage.stockout.listItems", + "type": "add", + "summary": "新增 storage.stockout 出库单模块(非订单出库单能力)", + "detail": "新增 storage.stockout.list / toOrder / listItems 接口,作为非订单出库单的主出口(对应奇门 stockout.create)。storage.delivery.* 仅作为兼容转发保留;底层部分能力仍复用 order 模块。" + }, + { + "id": "2026.04.08-system-21", + "date": "2026-04-08", + "method": "storage.stockout.toOrder", + "type": "change", + "summary": "将 storage.stockout.toOrder 标记为占位接口", + "detail": "storage.stockout.toOrder 当前仅保留方法名用于后续扩展,暂不开放实际逻辑。调用时返回 code=405、message=占位接口,暂未开放。" + } ] \ No newline at end of file diff --git a/src/views/storage/entry/component/entrydetail.vue b/src/views/storage/entry/component/entrydetail.vue index 26766a2e..170d5e1e 100644 --- a/src/views/storage/entry/component/entrydetail.vue +++ b/src/views/storage/entry/component/entrydetail.vue @@ -3,7 +3,7 @@
刷新 - 新增入库 + EXCEL导出 导出 @@ -118,50 +118,31 @@ async function loadEntryDetail() { try { console.log('加载入库单详情, ID:', props.id) - let useMock = false - try { - const res = await entryApi.getEntryDetail({ - id: props.id, - page: pagination.currentPage, - page_size: pagination.pageSize - }) - if (res && res.code === 200 && res.data) { - tableData.value = Array.isArray(res.data) ? res.data : [res.data] - pagination.total = res.total || tableData.value.length - } else { - useMock = true - } - } catch (apiError) { - console.warn('详情API调用失败,改用模拟数据', apiError) - useMock = true - } - - if (useMock) { - // 模拟数据源 - const allMockDetails: Record = { - 90: [ - { id: 91, order_id: 90, out_biz_code: '', order_line_no: 1, owner_code: 'khgj2025100901', item_code: '6977520597331', item_id: 0, count: 5000, inventory_type: 'ZP', stock_id: 101845, received_quantity: 5000, confirm_quantity: 5000 } - ], - 93: [ - { id: 94, order_id: 93, out_biz_code: '', order_line_no: 1, owner_code: 'khgj2025100901', item_code: '6977520597331', item_id: 1000689, count: 1000, inventory_type: 'ZP', stock_id: 101845, received_quantity: 1000, confirm_quantity: 1000 } - ], - 95: [ - { id: 95, order_id: 95, out_biz_code: '', order_line_no: 2786714391389667366, owner_code: 'wdt02060120001', item_code: '三层钢蒸锅+屉26cm', item_id: 1000690, count: 1000, inventory_type: 'ZP', stock_id: 101874, received_quantity: 1000, confirm_quantity: 1000 } - ], - 96: [ - { id: 96, order_id: 96, out_biz_code: '', order_line_no: 2786720123363262666, owner_code: 'wdt02060120001', item_code: 'rrxm202502', item_id: 1000691, count: 1000, inventory_type: 'ZP', stock_id: 101875, received_quantity: 1000, confirm_quantity: 1000 } - ], - 97: [ - { id: 97, order_id: 97, out_biz_code: '', order_line_no: 1, owner_code: 'khgj2025100901', item_code: '20251023-18', item_id: 1000686, count: 1000, inventory_type: 'ZP', stock_id: 101842, received_quantity: 0, confirm_quantity: 0 } - ] - } - - const mockDetails = allMockDetails[props.id] || [] - tableData.value = mockDetails - pagination.total = mockDetails.length + const res = await entryApi.getEntryDetail({ + id: props.id + }) + + if (res && res.code === 200 && res.data?.entryOrder) { + const entryOrder = res.data.entryOrder + // 接口文档1显示 items 在 entryOrder 对象中 + const items = entryOrder.items || [] + + // 处理 items 数据,将嵌套的 stock 信息平铺,方便表格展示 + tableData.value = items.map((item: any) => ({ + ...item, + item_name: item.stock?.item_name || '', + // 如果列配置中有其他需要从 stock 获取的字段,可以在此映射 + })) + + pagination.total = tableData.value.length + } else { + throw new Error(res?.message || '接口返回数据异常') } } catch (error) { + console.error('获取明细失败:', error) ElMessage.error('获取明细失败') + tableData.value = [] + pagination.total = 0 } finally { loading.value = false } @@ -185,24 +166,9 @@ async function submitAddDetail() { addLoading.value = true try { - const params = { - order_id: Number(props.id), - count: addForm.count, - item_code: addForm.item_code - } - - const res = await entryApi.addDetail(params) - if (res && res.code === 200) { - ElMessage.success('新增明细成功') - addDialogVisible.value = false - loadEntryDetail() - emit('refresh') - } else { - ElMessage.error(res?.message || '新增失败') - } - } catch (e) { - console.error('新增明细错误:', e) - ElMessage.error('操作失败') + ElMessage.warning('接口已下线:storage.entry.addDetail 不再对外开放') + addDialogVisible.value = false + emit('refresh') } finally { addLoading.value = false } diff --git a/src/views/storage/entry/component/entryoperate.vue b/src/views/storage/entry/component/entryoperate.vue index 61a5fbc4..41f02105 100644 --- a/src/views/storage/entry/component/entryoperate.vue +++ b/src/views/storage/entry/component/entryoperate.vue @@ -49,10 +49,10 @@
- + 保存 - + 重置 diff --git a/src/views/storage/entry/index.vue b/src/views/storage/entry/index.vue index f102397f..9d3364b8 100644 --- a/src/views/storage/entry/index.vue +++ b/src/views/storage/entry/index.vue @@ -16,7 +16,7 @@
刷新 - 新建入库单 + 完成入库 批量作废 导出 @@ -64,6 +64,18 @@ + + + + + + @@ -193,6 +205,51 @@ function translateField(fieldValue: string, value: any) { return value } +function pad(n: number) { + return n < 10 ? '0' + n : String(n) +} + +function formatTime(val: any) { + if (!val && val !== 0) return '' + const d = new Date(val) + if (isNaN(d.getTime())) return String(val) + return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}` +} + +/** + * 将 scan-box 返回的条件标准化为后端推荐结构:{ operator, value, type } + * 支持三种情况: + * - 已经是 {value, operator, type} 形式:原样返回 + * - 是简单值(string/number/array):包装为 { operator: 'eq', value: val } + * - 空或 undefined:忽略该字段 + */ +function normalizeWhere(conds: any) { + if (!conds || typeof conds !== 'object') return {} + const where: any = {} + Object.keys(conds).forEach(key => { + const c = conds[key] + if (c === undefined) return + + // 已经是标准对象 + if (c && typeof c === 'object' && ('operator' in c || 'value' in c || 'type' in c)) { + // 保持 operator/value/type 字段,若缺失则做适度默认 + where[key] = { + operator: c.operator || (Array.isArray(c.value) ? 'in' : 'eq'), + value: c.value, + type: c.type || undefined + } + return + } + + // 简单类型,直接包装为 eq(数组则为 in) + where[key] = { + operator: Array.isArray(c) ? 'in' : 'eq', + value: c + } + }) + return where +} + function getStatusType(status: string) { const map: Record = { 'CREATED': 'info', @@ -225,24 +282,30 @@ async function loadData() { loading.value = true const start = Date.now() try { + const conditions = scanBox.value?.getConditions() || {} + const where = normalizeWhere(conditions) const params = { - page: pagination.currentPage, - page_size: pagination.pageSize, - quick_search: quickSearch.value, - sort_prop: currentSort.prop, - sort_order: currentSort.order, - ...(scanBox.value?.getConditions() || {}) + pagination: { + page: pagination.currentPage, + pageSize: pagination.pageSize + }, + sort: currentSort.prop ? { + sortField: currentSort.prop, + sortOrder: currentSort.order === 'ascending' ? 'ASC' : 'DESC' + } : undefined, + where: where } let useMock = false try { const res = await entryApi.getEntryList(params) - if (res && res.code === 200 && res.data?.list && res.data.list.length > 0) { + if (res && res.code === 200 && res.data?.list) { list.value = res.data.list - pagination.total = res.data.pagination?.total || res.data.list.length + pagination.total = res.data.pagination?.total || 0 + // 如果有 summary,可以考虑在此处处理 } else { useMock = true - console.log('API未返回数据,准备使用模拟数据') + console.log('API未返回有效数据,准备使用模拟数据') } } catch (apiError) { console.warn('API调用失败,改用模拟数据', apiError) @@ -440,8 +503,7 @@ const createForm = reactive({ }) function handleCreateEntry() { - Object.keys(createForm).forEach(key => createForm[key] = '') - createDialogVisible.value = true + ElMessage.warning('接口已下线:入库单不再支持手工新建,请使用快捷入库/匹配入库流程') } async function handleCompleteEntry() { @@ -479,27 +541,7 @@ function handleCreateDialogClosed() { } async function submitCreateEntry() { - if (!createForm.order_type) { - ElMessage.warning('请选择业务类型') - return - } - - createLoading.value = true - try { - const res = await entryApi.createEntry(createForm) - if (res && res.code === 200) { - ElMessage.success('新建入库单成功') - createDialogVisible.value = false - loadData() - } else { - ElMessage.error(res?.message || '新建失败') - } - } catch (e) { - console.error('新建入库单出错:', e) - ElMessage.error('新建入库单失败') - } finally { - createLoading.value = false - } + ElMessage.warning('接口已下线:storage.entry.create 不再对外开放') } async function confirmBatchCancel() { diff --git a/src/views/storage/inventory/index.vue b/src/views/storage/inventory/index.vue index c13a1a83..90edd97e 100644 --- a/src/views/storage/inventory/index.vue +++ b/src/views/storage/inventory/index.vue @@ -16,11 +16,11 @@
刷新 - 新建入库单 + 批量作废 导出 导入 - 快捷入库 +