diff --git a/dist.tar.gz b/dist.tar.gz index e7c6410a..376b4056 100644 Binary files a/dist.tar.gz and b/dist.tar.gz differ diff --git a/src/api/index.ts b/src/api/index.ts index 1697d21f..326aaeed 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -135,3 +135,18 @@ export function getExpressList(){ isSystemApi: true } as any) } + +/** 查询所有已启用的接口类型列表(无需权限,仅需登录) */ +export function listInterfaceTypes() { + return request({ + url: '/system', + method: 'post', + params: { + method: 'index.listInterfaceTypes', + v: '1.0', + timestamp: new Date().getTime() + }, + data: {}, + isSystemApi: true + } as any) +} diff --git a/src/api/stock.ts b/src/api/stock.ts index 5470b535..facb66b6 100644 --- a/src/api/stock.ts +++ b/src/api/stock.ts @@ -326,6 +326,20 @@ export function backData(data: any) { } as any) } +export function getStockDetail(stock_id: number, pagination?: { page: number; pageSize: number }) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'stock.warehouse.getStockDetail', + v, + timestamp: new Date().getTime() + }, + data: { stock_id, ...(pagination ? { pagination } : {}) }, + isSystemApi: true + } as any) +} + // 已弃用 // export function warehouseSearch(data:any) { // return request({ diff --git a/src/api/storage/inventory.ts b/src/api/storage/inventory.ts new file mode 100644 index 00000000..06a71584 --- /dev/null +++ b/src/api/storage/inventory.ts @@ -0,0 +1,41 @@ +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({ + url: '/system', + method: 'post', + params: { + method: 'storage.inventory.list', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} \ No newline at end of file diff --git a/src/api/storage/transaction.ts b/src/api/storage/transaction.ts new file mode 100644 index 00000000..35efa7e2 --- /dev/null +++ b/src/api/storage/transaction.ts @@ -0,0 +1,37 @@ +import request from '@/utils/request' + +const v = "1.0" + +/** + * 出入库记录列表查询 + * 支持where条件、分页、排序、批次分组切换。 + * 默认按库位合并数量(合并模式),group_by_batch=true时返回每条明细(明细模式) + */ +export function getTransactionList(data: { + /** 统一where条件对象,可用字段:transaction_type(INBOUND/OUTBOUND)、stock_id、space_id、store_id、order_type(SCRK/MATCH)、order_no、inventory_type(ZP/CC/JS/XS/ZT/DJ/FP)、operator_name、created_at(支持between) */ + where?: Record + /** 分页参数,默认page=1, pageSize=20 */ + pagination?: { + page?: number + pageSize?: number + } + /** 排序参数,默认sortField='created_at', sortOrder='DESC' */ + sort?: { + sortField?: string + sortOrder?: string + } + /** 是否按批次查询,默认false。false=合并模式(按库位+商品聚合),true=明细模式(逐条返回) */ + group_by_batch?: boolean +}): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'storage.transaction.list', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} diff --git a/src/api/storeWarehouse.ts b/src/api/storeWarehouse.ts index 3e2d733c..c4b1c64a 100644 --- a/src/api/storeWarehouse.ts +++ b/src/api/storeWarehouse.ts @@ -131,10 +131,14 @@ export function storeWarehouseSavePolicyConfig(data: { } as any) } -/** 人工调整签约关系下的面单余额并记录变更日志 */ +/** + * 设置签约关系下的面单目标余额(覆盖写入,非增减量)并记录变更日志。 + * 兼容字段名:target_quantity / print_quantity / change_quantity / adjust_quantity,均解释为目标余额。 + */ export function storeWarehouseAdjustPrintQuantity(data: { id: number - change_quantity: number + /** 目标面单余额(覆盖当前余额,非增减量) */ + target_quantity: number reason: string business_type?: string business_id?: number @@ -172,12 +176,14 @@ export function listApiConfig(data: { } /** 保存接口配置(新增或更新) + * - app_name:必传,不再自动生成 * - QM_WMS 类型:须填写 qimen_app_key / qimen_customer_id / qimen_warehouse_code - * - OPEN_API 类型:系统自动生成 self_app_key / self_app_secret,无需传入奇门字段 + * - OPEN_API 类型:系统自动生成 self_app_key(WMS+32位HEX)和 self_app_secret(64位HEX),无需传入奇门字段 */ export function saveApiConfig(data: { id: number interface_type_id: number + /** 应用名称(必传,不再自动生成) */ app_name: string qimen_app_key?: string qimen_customer_id?: string diff --git a/src/router/map.ts b/src/router/map.ts index 78c49732..4927fa6a 100644 --- a/src/router/map.ts +++ b/src/router/map.ts @@ -20,7 +20,5 @@ export const componentMap: Record = { 'system/setting/printTemplate/index': () => import('@/views/system/setting/printTemplate/index.vue'), // 'system/setting/printStation/index': () => import('@/views/system/setting/printStation/index.vue'), 'system/print/station': () => import('@/views/system/setting/printStation/index.vue'), - // 'system/StoreManagement/station2': () => import('@/views/system/setting/printStation/index2.vue'), - // 'system/setting/printStation': () => import('@/views/system/setting/printStation/index.vue'), - // 'admin/land': () => import('@/views/admin/land/index.vue') + 'storage/log': () => import('@/views/storage/log/index.vue'), }; \ No newline at end of file diff --git a/src/test.txt b/src/test.txt index 3e1e463e..a8de5a30 100644 --- a/src/test.txt +++ b/src/test.txt @@ -1,2 +1,166 @@ 接口文档更新: -[{"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 入口继续用于直接查看当前生效文档。"]}] \ No newline at end of file +[ + { + "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", + "method": "storage.inventory.transferByProduct", + "type": "added", + "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。" + } +] \ No newline at end of file diff --git a/src/views/stock/stock/component/add.vue b/src/views/stock/stock/component/add.vue index 4d17dad7..34b62835 100644 --- a/src/views/stock/stock/component/add.vue +++ b/src/views/stock/stock/component/add.vue @@ -2,11 +2,12 @@
- + @@ -287,7 +288,7 @@ diff --git a/src/views/stock/stock/stock-config.ts b/src/views/stock/stock/stock-config.ts index 88dc5d0d..fdcf4809 100644 --- a/src/views/stock/stock/stock-config.ts +++ b/src/views/stock/stock/stock-config.ts @@ -425,6 +425,7 @@ export const stockBatchConfig = { export const stockDefaultFormData = { item_code: '', store_id: undefined as number | undefined, + store_name: '', barcode: '', item_name: '', sku_property: '', diff --git a/src/views/storage/entry/entry-config.ts b/src/views/storage/entry/entry-config.ts index f959bcce..9c697351 100644 --- a/src/views/storage/entry/entry-config.ts +++ b/src/views/storage/entry/entry-config.ts @@ -5,6 +5,7 @@ export const availableFields = [ { label: '已创建', value: 'CREATED' }, { label: '待入库', value: 'PENDING' }, { label: '入库中', value: 'PARTIAL' }, + { label: '部分收货', value: 'PARTIAL_RECEIVED' }, { label: '已完成', value: 'COMPLETED' }, { label: '已取消', value: 'CANCELLED' }, ]}, @@ -13,6 +14,12 @@ export const availableFields = [ { label: '退货入库', value: 'THRK' }, { label: '其他入库', value: 'QTRK' }, { label: '盘点入库', value: 'PDRK' }, + { label: '生产入库', value: 'SCRK' }, + { label: '领用入库', value: 'LYRK' }, + { label: '拆解入库', value: 'CCRK' }, + { label: '调拨入库', value: 'DBRK' }, + { label: 'B2B入库', value: 'B2BRK' }, + { label: '虚拟入库', value: 'XNRK' }, ]}, { label: '同步状态', value: 'sync_status', type: 'select', options: [ { label: '待推送', value: 'PENDING' }, diff --git a/src/views/storage/entry/index.vue b/src/views/storage/entry/index.vue index a3827f7a..f102397f 100644 --- a/src/views/storage/entry/index.vue +++ b/src/views/storage/entry/index.vue @@ -198,6 +198,7 @@ function getStatusType(status: string) { 'CREATED': 'info', 'PENDING': 'warning', 'PARTIAL': 'primary', + 'PARTIAL_RECEIVED': 'primary', 'COMPLETED': 'success', 'CANCELLED': 'danger' } @@ -236,9 +237,9 @@ async function loadData() { let useMock = false try { const res = await entryApi.getEntryList(params) - if (res && res.code === 200 && res.data && res.data.length > 0) { - list.value = res.data - pagination.total = res.total || res.data.length + if (res && res.code === 200 && res.data?.list && res.data.list.length > 0) { + list.value = res.data.list + pagination.total = res.data.pagination?.total || res.data.list.length } else { useMock = true console.log('API未返回数据,准备使用模拟数据') diff --git a/src/views/storage/inventory/entry-config.ts b/src/views/storage/inventory/entry-config.ts index 96dff267..79cf96ed 100644 --- a/src/views/storage/inventory/entry-config.ts +++ b/src/views/storage/inventory/entry-config.ts @@ -1,49 +1,33 @@ export const availableFields = [ - { label: '入库单号', value: 'entry_order_code', type: 'input' }, + { label: '商品ID', value: 'stock_id', type: 'input' }, + { label: '库位名称', value: 'space_id', type: 'input' }, { label: '货主', value: 'store_id', type: 'select', options: [] }, - { label: '状态', value: 'order_status', type: 'select', options: [ - { label: '待处理', value: 'CREATED' }, - { label: '已完成', value: 'COMPLETED' }, - { label: '已关闭', value: 'CLOSED' }, - { label: '已取消', value: 'CANCELLED' } + { label: '库存类型', value: 'inventory_type', type: 'select', options: [ + { label: '正品', value: 'ZP' }, + { label: '次品', value: 'CC' }, + { label: '机损', value: 'JS' }, + { label: '箱损', value: 'XS' }, + { label: '在途', value: 'ZT' }, + { label: '冻结', value: 'DJ' }, + { label: '分配', value: 'FP' } ]}, - { label: '业务类型', value: 'order_type', type: 'select', options: [ - { label: '采购入库', value: 'CGRK' }, - { label: '退货入库', value: 'THRK' }, - { label: '调拨入库', value: 'DBRK' }, - { label: '盘盈入库', value: 'PYRK' }, - { label: '其他入库', value: 'QTRK' } - ]}, - { label: '供应商', value: 'supplier_name', type: 'input' }, - { label: '运单号', value: 'express_code', type: 'input' }, - { label: '单据编号', value: 'purchase_order_code', type: 'input' }, - { label: '是否同步', value: 'sync_status', type: 'select', options: [ - { label: '同步成功', value: 'SUCCESS' }, - { label: '等待同步', value: 'PENDING' }, - { label: '同步失败', value: 'FAIL' } - ]}, - { label: '数据来源', value: 'source_type', type: 'select', options: [ - { label: '奇门', value: 'QM' }, - { label: '手工创建', value: 'MANUAL' }, - { label: '接口导入', value: 'API' } - ]}, - { label: '创建日期', value: 'create_time_range', type: 'daterange' } + { label: '批次号', value: 'batch_no', type: 'input' }, + { label: '入库单号', value: 'inbound_order_no', type: 'input' }, + { label: '创建日期', value: 'created_at', type: 'daterange' } ] export const productstockColums = [ - { prop: 'id', label: 'ID', width: '80' }, - { prop: 'entry_order_code', label: '入库单号', width: '180' }, + { prop: 'stock_id', label: '商品ID', width: '100' }, + { prop: 'item_code', label: '商品编码', width: '150' }, + { prop: 'item_name', label: '商品名称', width: '200' }, + { prop: 'space_code', label: '库位名称', width: '150' }, { prop: 'store_name', label: '货主', width: '120' }, - { prop: 'order_type', label: '业务类型', width: '100' }, - { prop: 'purchase_order_code', label: '单据编号', width: '150' }, - { prop: 'order_status', label: '状态', width: '100' }, - { prop: 'total_order_lines', label: '物料种数', width: '100' }, - { prop: 'supplier_name', label: '供应商', width: '150' }, - { prop: 'logistics_name', label: '物流公司', width: '120' }, - { prop: 'express_code', label: '运单号', width: '150' }, - { prop: 'order_create_time', label: '创建时间', width: '160' }, - { prop: 'sync_status', label: '同步状态', width: '100' }, - { prop: 'source_type', label: '数据来源', width: '100' } + { prop: 'inventory_type', label: '库存类型', width: '100' }, + { prop: 'quantity', label: '总数量', width: '100' }, + { prop: 'available_quantity', label: '可用数量', width: '100' }, + { prop: 'locked_quantity', label: '锁定数量', width: '100' }, + { prop: 'last_inbound_time', label: '最后入库时间', width: '160' }, + { prop: 'batch_count', label: '批次数', width: '80' } ] export const productstockDetail = [ diff --git a/src/views/storage/inventory/index.vue b/src/views/storage/inventory/index.vue index 019e6a70..c13a1a83 100644 --- a/src/views/storage/inventory/index.vue +++ b/src/views/storage/inventory/index.vue @@ -20,6 +20,7 @@ 批量作废 导出 导入 + 快捷入库
- + + + - - + @@ -675,7 +673,7 @@ - 确认调整 + 确认设置 @@ -735,6 +733,7 @@ import { ref, reactive, onMounted, computed } from 'vue' import { ElMessage, ElMessageBox } from 'element-plus' import { Search, Plus, Refresh, QuestionFilled } from '@element-plus/icons-vue' import { storeWarehouseList, storeWarehouseSign, storeWarehouseUnbind, storeWarehouseRename, storeWarehouseGetPolicyConfig, storeWarehouseGetPolicyConfigFields, storeWarehouseSavePolicyConfig, saveApiConfig, storeWarehouseDeleteQimenConfig, storeWarehouseAdjustPrintQuantity, listApiConfig } from '@/api/storeWarehouse' +import { listInterfaceTypes } from '@/api/index' import ScanBox from '@/components/ScanBox/index.vue' import UpperTable from '@/components/UpperTable/index.vue' import Detail from './component/detail.vue' @@ -1122,8 +1121,8 @@ const qimenDialog = reactive({ loading: false, contractRow: null as any, list: [] as any[], - availableTypes: [] as any[], // 所有可用接口类型(由 listApiConfig 返回或从 list 推导) - selectableTypes: [] as any[], // 新增时可选的类型(已配置类型排除) + availableTypes: [] as any[], // 用于提交时解析 interface_type_id(来源:listInterfaceTypes) + selectableTypes: [] as any[], // 保留字段(兼容,实际下拉由 selectableLocalTypes 驱动) total: 0, contract: null as any, formVisible: false, @@ -1131,6 +1130,9 @@ const qimenDialog = reactive({ editingConfig: null as any }) +/** 新增时可选的接口类型 */ +const selectableTypes = computed(() => qimenDialog.availableTypes) + const qimenForm = reactive>({ ...qimenFormDefault }) // ─── 面单余额调整 ───────────────────────────────────────────────────────── @@ -1149,8 +1151,8 @@ function resetAdjustBalanceDialog() { } async function submitAdjustBalance() { - if (!adjustBalanceForm.change_quantity || adjustBalanceForm.change_quantity === 0) { - ElMessage.warning('请输入有效的调整数量') + if (adjustBalanceForm.target_quantity === undefined || adjustBalanceForm.target_quantity === null) { + ElMessage.warning('请输入目标面单余额') return } if (!adjustBalanceForm.reason?.trim()) { @@ -1162,12 +1164,12 @@ async function submitAdjustBalance() { try { const res = await storeWarehouseAdjustPrintQuantity({ id: adjustBalanceDialog.contractRow.id, - change_quantity: adjustBalanceForm.change_quantity, + target_quantity: adjustBalanceForm.target_quantity, reason: adjustBalanceForm.reason.trim() }) as any if (res?.flag === 'success' || res?.code === 200) { - ElMessage.success('面单余额调整成功') + ElMessage.success('面单余额设置成功') adjustBalanceDialog.visible = false loadList() // 刷新列表 } else { @@ -1202,40 +1204,37 @@ async function loadQimenConfigs() { if (!qimenDialog.contractRow) return qimenDialog.loading = true try { - const res = await listApiConfig({ - id: qimenDialog.contractRow.id - }) as any + // 并行获取已配置列表和全局接口类型列表 + const [res, typesRes] = await Promise.all([ + listApiConfig({ id: qimenDialog.contractRow.id }) as Promise, + listInterfaceTypes() as Promise + ]) + + // listInterfaceTypes 接口返回 { list: [...], total, ... } + const serverTypes: any[] = Array.isArray(typesRes?.list) ? typesRes.list : [] + + // 以接口类型列表作为主数据源;对于历史数据中未出现在 serverTypes 的类型进行兜底补充 + const typeMap = new Map(serverTypes.map((t: any) => [t.id, t])) + if (res?.data) { qimenDialog.list = res.data.list || [] qimenDialog.total = res.data.total || 0 qimenDialog.contract = res.data.contract || null - // 优先使用后端返回的专用字段,如没有则从 list 中提取接口类型信息作为备用 - const directTypes = - res.data.available_types || - res.data.availableTypes || - res.data.types || - res.data.interface_types || - null - - if (directTypes && directTypes.length > 0) { - qimenDialog.availableTypes = directTypes - } else { - // 从 list 中重建接口类型列表(去重) - const typeMap = new Map() - ;(res.data.list || []).forEach((item: any) => { - const tid = item.interface_type_id - if (tid && !typeMap.has(tid)) { - typeMap.set(tid, { - id: tid, - interface_code: item.interface_code || item.interface_category || '', - interface_name: item.interface_name || item.interface_code || `类型 ${tid}` - }) - } - }) - qimenDialog.availableTypes = Array.from(typeMap.values()) - } + // 将已配置列表中未被 listInterfaceTypes 收录的历史类型追加进去(兜底) + ;(res.data.list || []).forEach((item: any) => { + const tid = item.interface_type_id + if (tid && !typeMap.has(tid)) { + typeMap.set(tid, { + id: tid, + interface_code: item.interface_code || item.interface_category || '', + interface_name: item.interface_name || item.interface_code || `类型 ${tid}` + }) + } + }) } + + qimenDialog.availableTypes = Array.from(typeMap.values()) } catch { ElMessage.error('加载接口配置列表失败') } finally { @@ -1243,14 +1242,8 @@ async function loadQimenConfigs() { } } -function handleInterfaceTypeChange(typeId: number) { - const type = qimenDialog.availableTypes.find((t: any) => t.id === typeId) - if (type) { - qimenForm.interface_code = type.interface_code || type.code || type.interface_category || '' - } else { - qimenForm.interface_code = '' - } - // 切换类型时清空奇门专属字段 +function handleInterfaceTypeChange(_code: string) { + // interface_code 已由 v-model 绑定自动更新,此处只做联动清空 qimenForm.qimen_app_key = '' qimenForm.qimen_customer_id = '' qimenForm.qimen_warehouse_code = '' @@ -1266,23 +1259,16 @@ function openQimenForm(config: any) { if (config.is_enabled !== undefined) qimenForm.is_enabled = config.is_enabled } else { Object.assign(qimenForm, qimenFormDefault) - // 新增时:计算尚未配置的类型(已配置的不再允许重复新增) - const configuredTypeIds = new Set(qimenDialog.list.map((item: any) => item.interface_type_id)) - qimenDialog.selectableTypes = qimenDialog.availableTypes.filter( - (t: any) => !configuredTypeIds.has(t.id) - ) - // 若剩一种可选,自动选中 - if (qimenDialog.selectableTypes.length === 1) { - const t = qimenDialog.selectableTypes[0] - qimenForm.interface_type_id = t.id - qimenForm.interface_code = t.interface_code || t.code || t.interface_category || '' + // 若只有一个接口类型,自动选中 + if (selectableTypes.value.length === 1) { + qimenForm.interface_code = selectableTypes.value[0]?.interface_code ?? '' } } qimenDialog.formVisible = true } async function submitQimenForm() { - if (!qimenForm.interface_type_id) { + if (!qimenForm.interface_code) { ElMessage.warning('请选择接口类型') return } @@ -1307,22 +1293,29 @@ async function submitQimenForm() { return } } + // 解析 interface_type_id:编辑时来自已有配置,新增时从 availableTypes 按 interface_code 反查 + const resolvedTypeId: number | undefined = + qimenDialog.editingConfig?.interface_type_id ?? + qimenDialog.availableTypes.find((t: any) => t.interface_code === qimenForm.interface_code)?.id + if (!resolvedTypeId) { + ElMessage.warning('无法解析接口类型ID,请稍后重试或刷新页面') + return + } qimenDialog.formLoading = true try { - // 构建请求载荷,不提交 interface_code(仅属前端状态) - const { interface_code: _code, ...formData } = qimenForm - const payload: any = { - id: qimenDialog.contractRow?.id, - interface_type_id: qimenDialog.editingConfig?.interface_type_id ?? qimenForm.interface_type_id, - ...formData + // 仅提交 saveApiConfig 接口所要求的字段 + const payload = { + id: qimenDialog.contractRow?.id as number, + interface_type_id: resolvedTypeId, + app_name: qimenForm.app_name.trim() + } as const + // QM_WMS 类型额外传奇门字段 + if (isQmWms) { + ;(payload as any).qimen_app_key = qimenForm.qimen_app_key.trim() + ;(payload as any).qimen_customer_id = qimenForm.qimen_customer_id.trim() + ;(payload as any).qimen_warehouse_code = qimenForm.qimen_warehouse_code.trim() } - // OPEN_API 类型不传奇门字段 - if (!isQmWms) { - delete payload.qimen_app_key - delete payload.qimen_customer_id - delete payload.qimen_warehouse_code - } - const res = await saveApiConfig(payload) as any + const res = await saveApiConfig(payload as any) as any if (res?.flag === 'success' || res?.code === 200) { const action = res.data?.action === 'create' ? '新增' : '更新' ElMessage.success(`奇门配置${action}成功`) diff --git a/src/views/store/store-config.ts b/src/views/store/store-config.ts index b38f1784..cb23e456 100644 --- a/src/views/store/store-config.ts +++ b/src/views/store/store-config.ts @@ -15,6 +15,12 @@ export const signFormDefault = { remask: '' } +/** 前端本地定义的接口类型选项,无需依赖后端接口返回即可渲染下拉菜单 */ +export const LOCAL_INTERFACE_TYPES: { interface_code: string; interface_name: string }[] = [ + { interface_code: 'QM_WMS', interface_name: '奇门仓储接口' }, + { interface_code: 'OPEN_API', interface_name: '第三方接口' } +] + // 接口配置(apiConfig)表单默认配置 export const qimenFormDefault = { interface_type_id: undefined as number | undefined, @@ -39,7 +45,7 @@ export const adjustBalanceDialogDefault = { // 面单余额调整表单默认配置 export const adjustBalanceFormDefault = { - change_quantity: undefined as number | undefined, + target_quantity: undefined as number | undefined, reason: '' } @@ -65,16 +71,15 @@ export const qimenFormItems = [ // 面单余额调整表单项配置 export const adjustBalanceFormItems = [ { - label: '调整数量', - prop: 'change_quantity', + label: '目标余额', + prop: 'target_quantity', type: 'number', required: true, - placeholder: '请输入调整数量(正数增加,负数扣减)', + placeholder: '请输入目标面单余额(将覆盖当前余额)', span: 24, rules: [ - { required: true, message: '请输入调整数量' }, - { type: 'number', message: '调整数量必须是数字' }, - { validator: (rule: any, value: any) => value !== 0, message: '调整数量不能为0' } + { required: true, message: '请输入目标面单余额' }, + { type: 'number', message: '目标余额必须是数字' } ] }, { @@ -110,7 +115,7 @@ export const columns = [ { prop: 'print_quantity', label: '面单余额', width: 100, align: 'center' }, //{ prop: 'is_auth_valid', label: '授权有效', width: 90, align: 'center' }, // { prop: 'remaining_days', label: '剩余天数', width: 90, align: 'center' }, - { prop: 'qimen_config', label: '奇门配置', width: 100, align: 'center' }, + { prop: 'has_qimen_config', label: '奇门配置', width: 100, align: 'center' }, { prop: 'apply_time', label: '申请时间', width: 160, align: 'center' }, { prop: 'actions', label: '操作', width: 380, align: 'center', fixed: 'right' } ] @@ -152,7 +157,7 @@ export const detailPanel = [ { prop: 'apply_time', label: '申请时间' }, { prop: 'auth_period', label: '授权有效期', span: 2 }, { prop: 'review_comment', label: '审核意见' }, - { prop: 'qimen_config', label: '奇门配置', span: 2 } + { prop: 'has_qimen_config', label: '奇门配置', span: 2 } ] export default { diff --git a/src/接口文档1.txt b/src/接口文档1.txt index 7a9c342a..9e1d81ea 100644 --- a/src/接口文档1.txt +++ b/src/接口文档1.txt @@ -1,228 +1,956 @@ -storage.receiving.getReceivingDetail接口返回以下数据: +所有请求为Post请求,请求Body为JSON格式 + +----- +库存模块 +storage.entry.list +入库单列表查询 + +Params (3) +名称 类型 必填 说明 +pagination object 否 分页参数,支持 page/pageSize +where object 否 统一 where 条件对象;推荐使用 { operator, value, type } 标准结构,历史简写会在 main 中自动标准化;支持 quickWhere、order_status、store_id、order_type、日期区间等字段。示例:where.order_status={operator:eq,value:waiting}; where.order_type={operator:eq,value:purchase}; where.create_time_start={value:2026-03-01}。 +sort object 否 排序参数,支持 sortField/sortOrder + +接口返回: { "flag": "success", "code": 200, "message": "查询成功", "data": { - "receiving": { - "id": 137, - "receiving_number": "R20546019", - "creator_id": 55, - "creator_snapshot": "{\"name\":\"陈庆\",\"employees_id\":55,\"id\":55}", - "status": "completed", - "detail_status": "partial_matched", - "storage_status": "none", - "delivery_method": "other", - "license_plate": null, - "tracking_number": null, - "loading_method": "without_pallet", - "video_device_id": null, - "total_items": 4, - "total_quantity": 4488, - "total_boxes": 26, - "total_pallets": 0, - "warehouse_id": 1000028, - "remark": "【完成收货】4/3/2026, 4:16:23 PM 陈庆", - "store_name": "加碗饭", - "store_id": 1000167, - "receiving_start_time": "2026-04-03T07:56:55.000Z", - "receiving_end_time": "2026-04-03T08:16:23.000Z", - "is_deleted": false, - "created_at": "2026-04-03T07:56:55.000Z", - "updated_at": "2026-04-03T08:16:23.000Z", - "details": [ - { - "id": 146, - "receiving_id": 137, - "product_name": "新商品", - "barcode": "6975773697976", - "product_snapshot": null, - "system_product_id": null, - "actual_quantity": 2000, - "box_quantity": 10, - "boxes_per_pallet": 200, - "pallet_quantity": 0, - "receiving_time": null, - "receiving_status": "pending", - "storage_status": "none", - "stored_quantity": 0, - "batch_number": "", - "production_date": null, - "expiry_date": null, - "remark": "", - "space_id": 1, - "creator_id": "00000000000000000055", - "box_width": "0.00", - "box_length": "0.00", - "box_height": "0.00", - "weight": 113, - "created_at": "2026-04-03T07:57:57.000Z", - "updated_at": "2026-04-03T08:02:58.000Z", - "images": [ - { - "id": 89386, - "file_id": 108395, - "warehouse_id": 1000028, - "business_type": "receivingItem", - "business_id": "146", - "display_order": 0, - "created_by": "陈庆", - "created_at": "2026-04-03T08:00:56.000Z" - } - ] + "list": [ + { + "id": 140, + "entry_order_code": "TEST-ENTRY-1775618607364", + "order_type": "CGRK", + "purchase_order_code": null, + "total_order_lines": 2, + "order_create_time": "2026-04-08T03:23:26.000Z", + "expect_start_time": null, + "expect_end_time": null, + "logistics_code": null, + "logistics_name": null, + "express_code": null, + "supplier_code": null, + "supplier_name": null, + "source_type": "API", + "order_status": "PARTIAL_RECEIVED", + "sync_status": "PENDING", + "sync_message": null, + "is_enabled": 1, + "created_at": "2026-04-08T03:23:26.000Z", + "updated_at": "2026-04-08T03:23:27.000Z", + "warehouse_id": 100000, + "store_id": 1000000, + "remark": null, + "store_name": null, + "warehouse_name": null, + "deleted_at": null, + "qimen_owner_code": null, + "qimen_warehouse_code": null, + "warehouse": { + "id": 100000, + "company_name": "测试仓" }, - { - "id": 147, - "receiving_id": 137, - "product_name": "新商品", - "barcode": "6975773697976", - "product_snapshot": null, - "system_product_id": null, - "actual_quantity": 1040, - "box_quantity": 13, - "boxes_per_pallet": 80, - "pallet_quantity": 0, - "receiving_time": null, - "receiving_status": "pending", - "storage_status": "none", - "stored_quantity": 0, - "batch_number": "", - "production_date": null, - "expiry_date": null, - "remark": "", - "space_id": 1, - "creator_id": "00000000000000000055", - "box_width": "0.00", - "box_length": "0.00", - "box_height": "0.00", - "weight": 396, - "created_at": "2026-04-03T08:03:44.000Z", - "updated_at": "2026-04-03T08:07:34.000Z", - "images": [ - { - "id": 89387, - "file_id": 108396, - "warehouse_id": 1000028, - "business_type": "receivingItem", - "business_id": "147", - "display_order": 0, - "created_by": "陈庆", - "created_at": "2026-04-03T08:06:13.000Z" - } - ] - }, - { - "id": 148, - "receiving_id": 137, - "product_name": "新商品", - "barcode": "6977375877350", - "product_snapshot": null, - "system_product_id": null, - "actual_quantity": 399, - "box_quantity": 1, - "boxes_per_pallet": 400, - "pallet_quantity": 0, - "receiving_time": null, - "receiving_status": "pending", - "storage_status": "none", - "stored_quantity": 0, - "batch_number": "", - "production_date": null, - "expiry_date": null, - "remark": "", - "space_id": 1, - "creator_id": "00000000000000000056", - "box_width": "0.00", - "box_length": "0.00", - "box_height": "0.00", - "weight": 52, - "created_at": "2026-04-03T08:03:57.000Z", - "updated_at": "2026-04-03T08:11:50.000Z", - "images": [ - { - "id": 89388, - "file_id": 108397, - "warehouse_id": 1000028, - "business_type": "receivingItem", - "business_id": "148", - "display_order": 0, - "created_by": "陈庆", - "created_at": "2026-04-03T08:09:03.000Z" - } - ] - }, - { - "id": 149, - "receiving_id": 137, - "product_name": "加碗饭-雅屏蔚蓝香型香水40ml", - "barcode": "6977375877336", - "product_snapshot": "{\"store_id\":1000167,\"store_name\":\"加碗饭\",\"updated_at\":\"2026-04-03T08:14:28.330Z\"}", - "system_product_id": 143280, - "actual_quantity": 1049, - "box_quantity": 3, - "boxes_per_pallet": 400, - "pallet_quantity": 0, - "receiving_time": null, - "receiving_status": "pending", - "storage_status": "none", - "stored_quantity": 0, - "batch_number": "", - "production_date": null, - "expiry_date": null, - "remark": "", - "space_id": 1, - "creator_id": "00000000000000000055", - "box_width": "0.00", - "box_length": "0.00", - "box_height": "0.00", - "weight": 51, - "created_at": "2026-04-03T08:13:40.000Z", - "updated_at": "2026-04-03T08:14:28.000Z", - "images": [ - { - "id": 89389, - "file_id": 108398, - "warehouse_id": 1000028, - "business_type": "receivingItem", - "business_id": "149", - "display_order": 0, - "created_by": "陈庆", - "created_at": "2026-04-03T08:14:11.000Z" - } - ] + "store": { + "id": 1000000, + "company_name": "测试货主1111" } - ], - "images": [ - { - "id": 89384, - "file_id": 108393, - "warehouse_id": 1000028, - "business_type": "receiving", - "business_id": "137", - "display_order": 0, - "created_by": "陈庆", - "created_at": "2026-04-03T07:57:18.000Z" + }, + { + "id": 139, + "entry_order_code": "TEST-ENTRY-1775618602967", + "order_type": "CGRK", + "purchase_order_code": null, + "total_order_lines": 2, + "order_create_time": "2026-04-08T03:23:22.000Z", + "expect_start_time": null, + "expect_end_time": null, + "logistics_code": null, + "logistics_name": null, + "express_code": null, + "supplier_code": null, + "supplier_name": null, + "source_type": "API", + "order_status": "COMPLETED", + "sync_status": "PENDING", + "sync_message": null, + "is_enabled": 1, + "created_at": "2026-04-08T03:23:22.000Z", + "updated_at": "2026-04-08T03:23:23.000Z", + "warehouse_id": 100000, + "store_id": 1000000, + "remark": null, + "store_name": null, + "warehouse_name": null, + "deleted_at": null, + "qimen_owner_code": null, + "qimen_warehouse_code": null, + "warehouse": { + "id": 100000, + "company_name": "测试仓" }, - { - "id": 89385, - "file_id": 108394, - "warehouse_id": 1000028, - "business_type": "receiving", - "business_id": "137", - "display_order": 0, - "created_by": "陈庆", - "created_at": "2026-04-03T07:57:23.000Z" + "store": { + "id": 1000000, + "company_name": "测试货主1111" + } + }, + { + "id": 138, + "entry_order_code": "TEST-ENTRY-1775618598551", + "order_type": "CGRK", + "purchase_order_code": null, + "total_order_lines": 2, + "order_create_time": "2026-04-08T03:23:18.000Z", + "expect_start_time": null, + "expect_end_time": null, + "logistics_code": null, + "logistics_name": null, + "express_code": null, + "supplier_code": null, + "supplier_name": null, + "source_type": "API", + "order_status": "COMPLETED", + "sync_status": "PENDING", + "sync_message": null, + "is_enabled": 1, + "created_at": "2026-04-08T03:23:18.000Z", + "updated_at": "2026-04-08T03:23:19.000Z", + "warehouse_id": 100000, + "store_id": 1000000, + "remark": null, + "store_name": null, + "warehouse_name": null, + "deleted_at": null, + "qimen_owner_code": null, + "qimen_warehouse_code": null, + "warehouse": { + "id": 100000, + "company_name": "测试仓" + }, + "store": { + "id": 1000000, + "company_name": "测试货主1111" + } + }, + { + "id": 137, + "entry_order_code": "SCRK17755814575753089", + "order_type": "SCRK", + "purchase_order_code": "R20550053", + "total_order_lines": 2, + "order_create_time": "2026-04-07T17:04:17.000Z", + "expect_start_time": null, + "expect_end_time": null, + "logistics_code": null, + "logistics_name": null, + "express_code": null, + "supplier_code": null, + "supplier_name": null, + "source_type": "WMS", + "order_status": "COMPLETED", + "sync_status": "SUCCESS", + "sync_message": "快捷入库-来自收货单 R20550053", + "is_enabled": 1, + "created_at": "2026-04-07T17:04:17.000Z", + "updated_at": "2026-04-07T17:04:17.000Z", + "warehouse_id": 100000, + "store_id": 1000000, + "remark": "快捷入库,关联收货单 R20550053", + "store_name": "测试货主", + "warehouse_name": "测试云仓", + "deleted_at": null, + "qimen_owner_code": null, + "qimen_warehouse_code": null, + "warehouse": { + "id": 100000, + "company_name": "测试仓" + }, + "store": { + "id": 1000000, + "company_name": "测试货主1111" + } + }, + { + "id": 135, + "entry_order_code": "SCRK17755813991973587", + "order_type": "SCRK", + "purchase_order_code": "R20550051", + "total_order_lines": 2, + "order_create_time": "2026-04-07T17:03:19.000Z", + "expect_start_time": null, + "expect_end_time": null, + "logistics_code": null, + "logistics_name": null, + "express_code": null, + "supplier_code": null, + "supplier_name": null, + "source_type": "WMS", + "order_status": "COMPLETED", + "sync_status": "SUCCESS", + "sync_message": "快捷入库-来自收货单 R20550051", + "is_enabled": 1, + "created_at": "2026-04-07T17:03:19.000Z", + "updated_at": "2026-04-07T17:03:19.000Z", + "warehouse_id": 100000, + "store_id": 1000000, + "remark": "快捷入库,关联收货单 R20550051", + "store_name": "测试货主", + "warehouse_name": "测试云仓", + "deleted_at": null, + "qimen_owner_code": null, + "qimen_warehouse_code": null, + "warehouse": { + "id": 100000, + "company_name": "测试仓" + }, + "store": { + "id": 1000000, + "company_name": "测试货主1111" + } + }, + { + "id": 134, + "entry_order_code": "SCRK17755813644731888", + "order_type": "SCRK", + "purchase_order_code": "R20550049", + "total_order_lines": 2, + "order_create_time": "2026-04-07T17:02:44.000Z", + "expect_start_time": null, + "expect_end_time": null, + "logistics_code": null, + "logistics_name": null, + "express_code": null, + "supplier_code": null, + "supplier_name": null, + "source_type": "WMS", + "order_status": "COMPLETED", + "sync_status": "SUCCESS", + "sync_message": "快捷入库-来自收货单 R20550049", + "is_enabled": 1, + "created_at": "2026-04-07T17:02:44.000Z", + "updated_at": "2026-04-07T17:02:44.000Z", + "warehouse_id": 100000, + "store_id": 1000000, + "remark": "快捷入库,关联收货单 R20550049", + "store_name": "测试货主", + "warehouse_name": "测试云仓", + "deleted_at": null, + "qimen_owner_code": null, + "qimen_warehouse_code": null, + "warehouse": { + "id": 100000, + "company_name": "测试仓" + }, + "store": { + "id": 1000000, + "company_name": "测试货主1111" + } + }, + { + "id": 133, + "entry_order_code": "SCRK17755813571468146", + "order_type": "SCRK", + "purchase_order_code": "R20550047", + "total_order_lines": 2, + "order_create_time": "2026-04-07T17:02:37.000Z", + "expect_start_time": null, + "expect_end_time": null, + "logistics_code": null, + "logistics_name": null, + "express_code": null, + "supplier_code": null, + "supplier_name": null, + "source_type": "WMS", + "order_status": "COMPLETED", + "sync_status": "SUCCESS", + "sync_message": "快捷入库-来自收货单 R20550047", + "is_enabled": 1, + "created_at": "2026-04-07T17:02:37.000Z", + "updated_at": "2026-04-07T17:02:37.000Z", + "warehouse_id": 100000, + "store_id": 1000000, + "remark": "快捷入库,关联收货单 R20550047", + "store_name": "测试货主", + "warehouse_name": "测试云仓", + "deleted_at": null, + "qimen_owner_code": null, + "qimen_warehouse_code": null, + "warehouse": { + "id": 100000, + "company_name": "测试仓" + }, + "store": { + "id": 1000000, + "company_name": "测试货主1111" + } + }, + { + "id": 132, + "entry_order_code": "SCRK17755813116084004", + "order_type": "SCRK", + "purchase_order_code": "R20550045", + "total_order_lines": 2, + "order_create_time": "2026-04-07T17:01:51.000Z", + "expect_start_time": null, + "expect_end_time": null, + "logistics_code": null, + "logistics_name": null, + "express_code": null, + "supplier_code": null, + "supplier_name": null, + "source_type": "WMS", + "order_status": "COMPLETED", + "sync_status": "SUCCESS", + "sync_message": "快捷入库-来自收货单 R20550045", + "is_enabled": 1, + "created_at": "2026-04-07T17:01:51.000Z", + "updated_at": "2026-04-07T17:01:52.000Z", + "warehouse_id": 100000, + "store_id": 1000000, + "remark": "快捷入库,关联收货单 R20550045", + "store_name": "测试货主", + "warehouse_name": "测试云仓", + "deleted_at": null, + "qimen_owner_code": null, + "qimen_warehouse_code": null, + "warehouse": { + "id": 100000, + "company_name": "测试仓" + }, + "store": { + "id": 1000000, + "company_name": "测试货主1111" + } + }, + { + "id": 129, + "entry_order_code": "SCRK17755811750561578", + "order_type": "SCRK", + "purchase_order_code": "R20550042", + "total_order_lines": 2, + "order_create_time": "2026-04-07T16:59:35.000Z", + "expect_start_time": null, + "expect_end_time": null, + "logistics_code": null, + "logistics_name": null, + "express_code": null, + "supplier_code": null, + "supplier_name": null, + "source_type": "WMS", + "order_status": "COMPLETED", + "sync_status": "SUCCESS", + "sync_message": "快捷入库-来自收货单 R20550042", + "is_enabled": 1, + "created_at": "2026-04-07T16:59:35.000Z", + "updated_at": "2026-04-07T16:59:35.000Z", + "warehouse_id": 100000, + "store_id": 1000000, + "remark": "快捷入库,关联收货单 R20550042", + "store_name": "测试货主", + "warehouse_name": "测试云仓", + "deleted_at": null, + "qimen_owner_code": null, + "qimen_warehouse_code": null, + "warehouse": { + "id": 100000, + "company_name": "测试仓" + }, + "store": { + "id": 1000000, + "company_name": "测试货主1111" + } + }, + { + "id": 128, + "entry_order_code": "SCRK17755809297447993", + "order_type": "SCRK", + "purchase_order_code": "R20550040", + "total_order_lines": 2, + "order_create_time": "2026-04-07T16:55:29.000Z", + "expect_start_time": null, + "expect_end_time": null, + "logistics_code": null, + "logistics_name": null, + "express_code": null, + "supplier_code": null, + "supplier_name": null, + "source_type": "WMS", + "order_status": "COMPLETED", + "sync_status": "SUCCESS", + "sync_message": "快捷入库-来自收货单 R20550040", + "is_enabled": 1, + "created_at": "2026-04-07T16:55:29.000Z", + "updated_at": "2026-04-07T16:55:30.000Z", + "warehouse_id": 100000, + "store_id": 1000000, + "remark": "快捷入库,关联收货单 R20550040", + "store_name": "测试货主", + "warehouse_name": "测试云仓", + "deleted_at": null, + "qimen_owner_code": null, + "qimen_warehouse_code": null, + "warehouse": { + "id": 100000, + "company_name": "测试仓" + }, + "store": { + "id": 1000000, + "company_name": "测试货主1111" + } + }, + { + "id": 126, + "entry_order_code": "SCRK17755808721935220", + "order_type": "SCRK", + "purchase_order_code": "R20550038", + "total_order_lines": 2, + "order_create_time": "2026-04-07T16:54:32.000Z", + "expect_start_time": null, + "expect_end_time": null, + "logistics_code": null, + "logistics_name": null, + "express_code": null, + "supplier_code": null, + "supplier_name": null, + "source_type": "WMS", + "order_status": "COMPLETED", + "sync_status": "SUCCESS", + "sync_message": "快捷入库-来自收货单 R20550038", + "is_enabled": 1, + "created_at": "2026-04-07T16:54:32.000Z", + "updated_at": "2026-04-07T16:54:32.000Z", + "warehouse_id": 100000, + "store_id": 1000000, + "remark": "快捷入库,关联收货单 R20550038", + "store_name": "测试货主", + "warehouse_name": "测试云仓", + "deleted_at": null, + "qimen_owner_code": null, + "qimen_warehouse_code": null, + "warehouse": { + "id": 100000, + "company_name": "测试仓" + }, + "store": { + "id": 1000000, + "company_name": "测试货主1111" + } + }, + { + "id": 125, + "entry_order_code": "SCRK17755805711459348", + "order_type": "SCRK", + "purchase_order_code": "R20550036", + "total_order_lines": 2, + "order_create_time": "2026-04-07T16:49:31.000Z", + "expect_start_time": null, + "expect_end_time": null, + "logistics_code": null, + "logistics_name": null, + "express_code": null, + "supplier_code": null, + "supplier_name": null, + "source_type": "WMS", + "order_status": "COMPLETED", + "sync_status": "SUCCESS", + "sync_message": "快捷入库-来自收货单 R20550036", + "is_enabled": 1, + "created_at": "2026-04-07T16:49:31.000Z", + "updated_at": "2026-04-07T16:49:31.000Z", + "warehouse_id": 100000, + "store_id": 1000000, + "remark": "快捷入库,关联收货单 R20550036", + "store_name": "测试货主", + "warehouse_name": "测试仓", + "deleted_at": null, + "qimen_owner_code": null, + "qimen_warehouse_code": null, + "warehouse": { + "id": 100000, + "company_name": "测试仓" + }, + "store": { + "id": 1000000, + "company_name": "测试货主1111" + } + }, + { + "id": 123, + "entry_order_code": "SCRK17755805135786513", + "order_type": "SCRK", + "purchase_order_code": "R20550034", + "total_order_lines": 2, + "order_create_time": "2026-04-07T16:48:33.000Z", + "expect_start_time": null, + "expect_end_time": null, + "logistics_code": null, + "logistics_name": null, + "express_code": null, + "supplier_code": null, + "supplier_name": null, + "source_type": "WMS", + "order_status": "COMPLETED", + "sync_status": "SUCCESS", + "sync_message": "快捷入库-来自收货单 R20550034", + "is_enabled": 1, + "created_at": "2026-04-07T16:48:33.000Z", + "updated_at": "2026-04-07T16:48:34.000Z", + "warehouse_id": 100000, + "store_id": 1000000, + "remark": "快捷入库,关联收货单 R20550034", + "store_name": "测试货主", + "warehouse_name": "测试仓", + "deleted_at": null, + "qimen_owner_code": null, + "qimen_warehouse_code": null, + "warehouse": { + "id": 100000, + "company_name": "测试仓" + }, + "store": { + "id": 1000000, + "company_name": "测试货主1111" + } + }, + { + "id": 122, + "entry_order_code": "SCRK17755800073229034", + "order_type": "SCRK", + "purchase_order_code": "R20550032", + "total_order_lines": 2, + "order_create_time": "2026-04-07T16:40:07.000Z", + "expect_start_time": null, + "expect_end_time": null, + "logistics_code": null, + "logistics_name": null, + "express_code": null, + "supplier_code": null, + "supplier_name": null, + "source_type": "WMS", + "order_status": "COMPLETED", + "sync_status": "SUCCESS", + "sync_message": "快捷入库-来自收货单 R20550032", + "is_enabled": 1, + "created_at": "2026-04-07T16:40:07.000Z", + "updated_at": "2026-04-07T16:40:07.000Z", + "warehouse_id": 100000, + "store_id": 1000000, + "remark": "快捷入库,关联收货单 R20550032", + "store_name": "测试货主", + "warehouse_name": "", + "deleted_at": null, + "qimen_owner_code": null, + "qimen_warehouse_code": null, + "warehouse": { + "id": 100000, + "company_name": "测试仓" + }, + "store": { + "id": 1000000, + "company_name": "测试货主1111" + } + }, + { + "id": 120, + "entry_order_code": "SCRK17755799483172971", + "order_type": "SCRK", + "purchase_order_code": "R20550030", + "total_order_lines": 2, + "order_create_time": "2026-04-07T16:39:08.000Z", + "expect_start_time": null, + "expect_end_time": null, + "logistics_code": null, + "logistics_name": null, + "express_code": null, + "supplier_code": null, + "supplier_name": null, + "source_type": "WMS", + "order_status": "COMPLETED", + "sync_status": "SUCCESS", + "sync_message": "快捷入库-来自收货单 R20550030", + "is_enabled": 1, + "created_at": "2026-04-07T16:39:08.000Z", + "updated_at": "2026-04-07T16:39:08.000Z", + "warehouse_id": 100000, + "store_id": 1000000, + "remark": "快捷入库,关联收货单 R20550030", + "store_name": "测试货主", + "warehouse_name": "", + "deleted_at": null, + "qimen_owner_code": null, + "qimen_warehouse_code": null, + "warehouse": { + "id": 100000, + "company_name": "测试仓" + }, + "store": { + "id": 1000000, + "company_name": "测试货主1111" + } + }, + { + "id": 97, + "entry_order_code": "2885-2021923981203890178", + "order_type": "CGRK", + "purchase_order_code": "", + "total_order_lines": 1, + "order_create_time": "2026-02-12T12:27:01.000Z", + "expect_start_time": "2026-02-12T12:27:01.000Z", + "expect_end_time": "2026-02-12T12:27:01.000Z", + "logistics_code": "", + "logistics_name": "", + "express_code": "", + "supplier_code": "", + "supplier_name": "", + "source_type": "QM", + "order_status": "CREATED", + "sync_status": "PENDING", + "sync_message": "", + "is_enabled": 1, + "created_at": "2026-02-12T12:27:01.000Z", + "updated_at": "2026-02-12T12:27:01.000Z", + "warehouse_id": 100000, + "store_id": 1000016, + "remark": "", + "store_name": "花颜物语", + "warehouse_name": "天豹2", + "deleted_at": null, + "qimen_owner_code": "khgj2025100901", + "qimen_warehouse_code": "khgj2025100902", + "warehouse": { + "id": 100000, + "company_name": "测试仓" + }, + "store": { + "id": 1000016, + "company_name": "测试" + } + }, + { + "id": 96, + "entry_order_code": "CGW2601201123", + "order_type": "CGRK", + "purchase_order_code": "", + "total_order_lines": 1, + "order_create_time": "2026-01-20T13:10:52.000Z", + "expect_start_time": "2026-01-20T13:10:57.000Z", + "expect_end_time": "2026-01-20T13:10:57.000Z", + "logistics_code": "", + "logistics_name": "", + "express_code": "", + "supplier_code": "0004", + "supplier_name": "NBBT30", + "source_type": "QM", + "order_status": "COMPLETED", + "sync_status": "SUCCESS", + "sync_message": "{\"confirmTime\":\"2026-01-20T13:11:25.830Z\",\"totalPlan\":1000,\"totalReceived\":1000,\"totalConfirmIncrement\":1000,\"isFin\":true,\"pendingUpdatesCount\":1,\"qimenResult\":{}}", + "is_enabled": 1, + "created_at": "2026-01-20T13:10:57.000Z", + "updated_at": "2026-01-20T13:11:25.000Z", + "warehouse_id": 100000, + "store_id": 1000016, + "remark": "", + "store_name": "花颜物语", + "warehouse_name": "天豹2", + "deleted_at": null, + "qimen_owner_code": "wdt02060120001", + "qimen_warehouse_code": "wdt02060120001", + "warehouse": { + "id": 100000, + "company_name": "测试仓" + }, + "store": { + "id": 1000016, + "company_name": "测试" + } + }, + { + "id": 95, + "entry_order_code": "CGW2601201120", + "order_type": "CGRK", + "purchase_order_code": "", + "total_order_lines": 1, + "order_create_time": "2026-01-20T12:48:05.000Z", + "expect_start_time": "2026-01-20T12:52:34.000Z", + "expect_end_time": "2026-01-20T12:52:34.000Z", + "logistics_code": "", + "logistics_name": "", + "express_code": "", + "supplier_code": "0004", + "supplier_name": "NBBT30", + "source_type": "QM", + "order_status": "COMPLETED", + "sync_status": "SUCCESS", + "sync_message": "{\"confirmTime\":\"2026-01-20T12:54:07.507Z\",\"totalPlan\":1000,\"totalReceived\":1000,\"totalConfirmIncrement\":1000,\"isFin\":true,\"pendingUpdatesCount\":1,\"qimenResult\":{}}", + "is_enabled": 1, + "created_at": "2026-01-20T12:52:34.000Z", + "updated_at": "2026-01-20T12:54:07.000Z", + "warehouse_id": 100000, + "store_id": 1000016, + "remark": "", + "store_name": "花颜物语", + "warehouse_name": "天豹2", + "deleted_at": null, + "qimen_owner_code": "wdt02060120001", + "qimen_warehouse_code": "wdt02060120001", + "warehouse": { + "id": 100000, + "company_name": "测试仓" + }, + "store": { + "id": 1000016, + "company_name": "测试" + } + }, + { + "id": 93, + "entry_order_code": "2885-2011043642256453634", + "order_type": "CGRK", + "purchase_order_code": "", + "total_order_lines": 1, + "order_create_time": "2026-01-13T13:17:13.000Z", + "expect_start_time": "2026-01-13T13:17:13.000Z", + "expect_end_time": "2026-01-13T13:17:13.000Z", + "logistics_code": "", + "logistics_name": "", + "express_code": "", + "supplier_code": "", + "supplier_name": "", + "source_type": "QM", + "order_status": "COMPLETED", + "sync_status": "SUCCESS", + "sync_message": "{\"confirmTime\":\"2026-01-13T13:17:43.052Z\",\"totalPlan\":1000,\"totalReceived\":1000,\"totalConfirmIncrement\":1000,\"isFin\":true,\"pendingUpdatesCount\":1,\"qimenResult\":{}}", + "is_enabled": 1, + "created_at": "2026-01-13T13:17:13.000Z", + "updated_at": "2026-01-13T13:17:43.000Z", + "warehouse_id": 100000, + "store_id": 1000016, + "remark": "", + "store_name": "花颜物语", + "warehouse_name": "天豹2", + "deleted_at": null, + "qimen_owner_code": "khgj2025100901", + "qimen_warehouse_code": "khgj2025100902", + "warehouse": { + "id": 100000, + "company_name": "测试仓" + }, + "store": { + "id": 1000016, + "company_name": "测试" + } + }, + { + "id": 90, + "entry_order_code": "2885-2011062548597596161", + "order_type": "CGRK", + "purchase_order_code": "", + "total_order_lines": 1, + "order_create_time": "2026-01-13T13:07:36.000Z", + "expect_start_time": "2026-01-13T13:07:36.000Z", + "expect_end_time": "2026-01-13T13:07:36.000Z", + "logistics_code": "", + "logistics_name": "", + "express_code": "", + "supplier_code": "", + "supplier_name": "", + "source_type": "QM", + "order_status": "COMPLETED", + "sync_status": "SUCCESS", + "sync_message": "{\"confirmTime\":\"2026-01-13T13:08:03.917Z\",\"totalPlan\":5000,\"totalReceived\":5000,\"totalConfirmIncrement\":5000,\"isFin\":true,\"pendingUpdatesCount\":1,\"qimenResult\":{}}", + "is_enabled": 1, + "created_at": "2026-01-13T13:07:36.000Z", + "updated_at": "2026-01-13T13:08:03.000Z", + "warehouse_id": 100000, + "store_id": 1000016, + "remark": "", + "store_name": "花颜物语", + "warehouse_name": "天豹2", + "deleted_at": null, + "qimen_owner_code": "khgj2025100901", + "qimen_warehouse_code": "khgj2025100902", + "warehouse": { + "id": 100000, + "company_name": "测试仓" + }, + "store": { + "id": 1000016, + "company_name": "测试" } - ], - "pagination": { - "total": 4, - "currentPage": 1, - "pageSize": 20, - "totalPages": 1, - "hasPrevious": false, - "hasNext": false } + ], + "pagination": { + "page": 1, + "pageSize": 20, + "total": 20, + "totalPages": 1, + "hasPrevious": false, + "hasNext": false + }, + "summary": { + "total": 20, + "pending": 0, + "creating": 0, + "created": 1, + "completed": 18, + "cancelled": 0 } }, - "timestamp": 1775208054 + "timestamp": 1775632562 +} + + + +----- +库存操作模块 + +storage.inventory.quickPutaway +收货单快捷入库上架。从收货单直接生成入库单并写入库存表,要求收货单已完成且所有明细已匹配系统商品 + +Params (1) +名称 类型 必填 说明 +receiving_id number 是 收货单ID,兼容 id + +----- +storage.inventory.list +库存列表查询(查 wms_storage),支持 where 条件、分页、排序、批次分组。默认按库位+商品合并数量(合并模式),group_by_batch=true 时返回每条库存明细(明细模式) + +Params (4) +名称 类型 必填 说明 +where object 否 统一 where 条件对象,可用字段:stock_id(商品ID)、space_id(库位ID)、store_id(货主ID)、inventory_type(ZP/CC/JS/XS/ZT/DJ/FP)、batch_no(批次号)、inbound_order_no(入库单号)、available_quantity(可用数量,支持 gt/lt)、inbound_time(入库时间,支持 between)、created_at(创建时间,支持 between) +pagination object 否 分页参数 { page, pageSize },默认 page=1, pageSize=20 +sort object 否 排序参数 { sortField, sortOrder },默认 sortField='created_at', sortOrder='DESC' +group_by_batch boolean 否 是否按批次查询,默认 false。false=合并模式(按库位+商品聚合quantity/locked_quantity/available_quantity),true=明细模式(逐条返回含 batch_no/production_date/expiry_date 等) + +接口返回: +{ + "flag": "success", + "code": 1, + "message": "ok", + "list": [ + { + "stock_id": 156968, + "space_id": 1, + "inventory_type": "ZP", + "warehouse_id": 100000, + "store_id": 1000000, + "quantity": "133", + "locked_quantity": "0", + "available_quantity": "133", + "first_inbound_time": "2026-04-08 00:39:08", + "last_inbound_time": "2026-04-08 11:23:27", + "batch_count": 15, + "stock": { + "id": 156968, + "item_code": "6902226191552", + "item_name": "新商品", + "sku_property": "", + "stock_unit": "个" + }, + "space": { + "id": 1, + "space_code": "AREA-01-01-01", + "custom_name": "默认收货区" + } + }, + { + "stock_id": 101841, + "space_id": 1, + "inventory_type": "ZP", + "warehouse_id": 100000, + "store_id": 1000000, + "quantity": "67", + "locked_quantity": "0", + "available_quantity": "67", + "first_inbound_time": "2026-04-08 00:39:08", + "last_inbound_time": "2026-04-08 11:23:27", + "batch_count": 15, + "stock": { + "id": 101841, + "item_code": "纸箱24121410-1", + "item_name": "纸箱24121410yc#zy-消退", + "sku_property": "", + "stock_unit": "盒" + }, + "space": { + "id": 1, + "space_code": "AREA-01-01-01", + "custom_name": "默认收货区" + } + } + ], + "pagination": { + "page": 1, + "pageSize": 20, + "total": 2, + "totalPages": 1 + }, + "timestamp": 1775637481 +} + +----- +storage.transaction.list +出入库记录列表查询,支持 where 条件、分页、排序、批次分组切换。默认按库位合并数量(合并模式),group_by_batch=true 时返回每条明细(明细模式) + +Params (4) +名称 类型 必填 说明 +where object 否 统一 where 条件对象,可用字段:transaction_type(ENUM INBOUND/OUTBOUND)、stock_id、space_id、store_id、order_type(SCRK/MATCH)、order_no、inventory_type(ZP/CC/JS/XS/ZT/DJ/FP)、operator_name、created_at(支持 between) +pagination object 否 分页参数 { page, pageSize },默认 page=1, pageSize=20 +sort object 否 排序参数 { sortField, sortOrder },默认 sortField='created_at', sortOrder='DESC' +group_by_batch boolean 否 是否按批次查询明细,默认 false。false=合并模式(按库位+商品聚合),true=明细模式(逐条返回) + +接口返回: +{ + "flag": "success", + "code": 1, + "message": "ok", + "list": [ + { + "stock_id": 156968, + "space_id": 1, + "transaction_type": "INBOUND", + "inventory_type": "ZP", + "warehouse_id": 100000, + "store_id": 1000000, + "order_type": "SCRK", + "quantity": "3", + "first_created_at": "2026-04-08 16:45:26", + "last_created_at": "2026-04-08 16:45:26", + "record_count": 1, + "stockItem": { + "id": 156968, + "item_code": "6902226191552", + "item_name": "新商品", + "sku_property": "", + "stock_unit": "个" + } + }, + { + "stock_id": 157008, + "space_id": 1, + "transaction_type": "INBOUND", + "inventory_type": "ZP", + "warehouse_id": 100000, + "store_id": 1000000, + "order_type": "SCRK", + "quantity": "7", + "first_created_at": "2026-04-08 16:45:25", + "last_created_at": "2026-04-08 16:45:25", + "record_count": 1, + "stockItem": { + "id": 157008, + "item_code": "6902226191553", + "item_name": "测试加货主商品1", + "sku_property": "", + "stock_unit": "件" + } + } + ], + "pagination": { + "page": 1, + "pageSize": 20, + "total": 2, + "totalPages": 1 + }, + "timestamp": 1775638230 } \ No newline at end of file diff --git a/src/测试文档.txt b/src/测试文档.txt new file mode 100644 index 00000000..8d9562aa --- /dev/null +++ b/src/测试文档.txt @@ -0,0 +1,12 @@ +storage.receiving.getReceivingList +Params (2) +名称 类型 必填 说明 +pagination object 否 分页参数,支持 page/pageSize +where object 否 统一 where 条件对象;推荐使用 { operator, value, type } 标准结构,历史简写会在 main 中自动标准化;支持 quickWhere、status、store_id、日期区间等字段。示例:where.status={operator:eq,value:finished}; where.store_id={operator:eq,value:1001}; where.create_time_start={value:2026-03-01}。 + +Response (3) +名称 类型 必填 说明 +list array 是 收货单列表 +pagination object 是 分页信息(page、pageSize、total、totalPages、hasPrevious、hasNext) +summary object 是 汇总信息(total_quantity、total_locked、total_available、total_items) +