From 279b292bae303869f89449182f9f7f4803f96fb0 Mon Sep 17 00:00:00 2001 From: liufumingren Date: Sun, 22 Mar 2026 16:21:09 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E8=B7=AF=E7=94=B1=E4=B8=8Emethods=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AI_METHOD_ROUTING.md | 226 ++ AI_TOOLBOX.md | 170 + README.md | 10 + app/controller/docs.js | 965 ++++++ app/model/order_delivery.js | 5 + app/model/order_delivery_factory.js | 1 + app/router.js | 3 + app/service/systemMethods/order.js | 351 ++ ...-delivery-time-to-order-delivery-tables.js | 63 + day.log | Bin 1210 -> 6188 bytes methods/qimen.json | 7 + methods/system.json | 2896 +++++++++++++++++ script/db-query.ps1 | 104 + script/tmp-compare-order-schema.cjs | 171 + script/tmp-gen-service-method-inventory.cjs | 97 + script/tmp-struct-system-params.cjs | 421 +++ script/tmp-update-ai-method-routing.cjs | 30 + tmp-order-schema-compare.json | 1610 +++++++++ tmp-order-schema-workflow.md | 81 + tmp-service-method-inventory.md | 105 + 20 files changed, 7316 insertions(+) create mode 100644 AI_METHOD_ROUTING.md create mode 100644 AI_TOOLBOX.md create mode 100644 app/controller/docs.js create mode 100644 app/service/systemMethods/order.js create mode 100644 database/migrations/20260322061000-add-delivery-time-to-order-delivery-tables.js create mode 100644 methods/qimen.json create mode 100644 methods/system.json create mode 100644 script/db-query.ps1 create mode 100644 script/tmp-compare-order-schema.cjs create mode 100644 script/tmp-gen-service-method-inventory.cjs create mode 100644 script/tmp-struct-system-params.cjs create mode 100644 script/tmp-update-ai-method-routing.cjs create mode 100644 tmp-order-schema-compare.json create mode 100644 tmp-order-schema-workflow.md create mode 100644 tmp-service-method-inventory.md diff --git a/AI_METHOD_ROUTING.md b/AI_METHOD_ROUTING.md new file mode 100644 index 0000000..654cf3f --- /dev/null +++ b/AI_METHOD_ROUTING.md @@ -0,0 +1,226 @@ +# AI 方法路由速查(WMS) + +本文用于让 AI/开发者快速理解入口路由与 method 到代码文件的映射关系。 + +## 1. 入口定义(router 风格) + +当前路由定义见 `app/router.js`: +- `POST /qimen` -> 奇门开发接口入口 +- `POST /system` -> Web 端与 PDA 端统一业务入口 + +注意:当前代码中 `/qimen` 与 `/system` 都是 `POST` 路由。 + +## 2. /system 入口说明(统一 Web + PDA) + +调用链: +1. `app/router.js` -> `controller.home.system` +2. `app/controller/home.js` 的 `system()` 读取 `ctx.query.method` +3. `app/service/system.js` 的 `callMethod(className, actionName, requestData, authHeader)` +4. 从 `ctx.service.systemMethods` 中按 method 分段下钻并执行目标函数 + +参数规则(system): +- 必填 query: `method`, `v`, `timestamp` +- 认证头:可传 `Authorization` +- 请求体:JSON(`system()` 中按 JSON 解析) + +外部请求示例: + +```text +POST http://127.0.0.1:6060/system?method=print.getComputerPrinter&v=1.0×tamp=1773386721 +``` + +示例 body(按业务方法需要): + +```json +{ + "id": 10001 +} +``` + +## 3. /qimen 入口说明(奇门开发接口) + +调用链: +1. `app/router.js` -> `controller.home.qimen` +2. `app/controller/home.js` 的 `qimen()` 读取 `ctx.query.method` +3. `app/service/qimen.js` 的 `callMethod(className, actionName, xmlData, ...)` +4. 从 `ctx.service.qimenMethods` 中按 method 分段下钻并执行目标函数 + +参数规则(qimen): +- 必填 query: `app_key`, `method`, `v`, `format`, `sign_method`, `sign`, `timestamp` +- 请求体:XML(`qimen()` 中按 XML 解析) + +## 4. method 指向规则(核心) + +统一规则: +- `method` 最后一段是函数名(actionName) +- 前面部分是 service 路径(className) +- service 路径按 `.` 拆分后,对应到 `app/service/systemMethods` 或 `app/service/qimenMethods` 的目录层级 + +### 4.1 /system 示例 + +1) `method=print.getComputerPrinter` +- service 路径:`print` +- 函数名:`getComputerPrinter` +- 对应文件:`app/service/systemMethods/print.js` +- 对应方法:`getComputerPrinter(data)` + +2) `method=setting.printTemplate.list` +- service 路径:`setting.printTemplate` +- 函数名:`list` +- 对应文件:`app/service/systemMethods/setting/printTemplate.js` +- 对应方法:`list(data)` + +3) `method=printer.station.list` +- service 路径:`printer.station` +- 函数名:`list` +- 对应文件:`app/service/systemMethods/printer/station.js` +- 对应方法:`list()` + +### 4.2 /qimen 示例 + +1) `method=deliveryorder.xxx` +- service 路径:`deliveryorder` +- 对应文件:`app/service/qimenMethods/deliveryorder.js` + +2) `method=taobao.qimen.service.xxx` +- service 路径:`taobao.qimen.service` +- 对应文件:`app/service/qimenMethods/taobao/qimen/service.js` + +## 5. AI 快速定位建议 + +当收到 `method=aaa.bbb.ccc` 时,优先按以下步骤定位: +1. 判定入口:`/system` 还是 `/qimen` +2. 取最后一段 `ccc` 作为函数名 +3. 其余部分 `aaa.bbb` 作为 service 路径 +4. 在对应 methods 目录查找文件并确认类方法是否存在 + +可用检索命令示例: + +```powershell +rg "getComputerPrinter|class PrintService" app/service/systemMethods +rg "class .*Service|module.exports" app/service/qimenMethods +``` +## 后续所有的method新增变更全部需要维护到下方 + + +## method结束 + +## 6. 全量 Service Method 能力清单(自动扫描) + +维护说明: +- 扫描范围:app/service/**/*.js +- 本节内容由脚本生成,新增/修改 service 后请同步刷新。 +- 刷新命令:node .\script\tmp-gen-service-method-inventory.cjs + + +自动生成时间: 2026-03-22T06:43:50.263Z + +扫描范围: app/service/**/*.js +文件数: 50 + +- app/service/api.js (1) + - callMethod +- app/service/apiMethods/test.js (4) + - entryorderConfirm, playbackRequest, fibonacci, fibonacciRecursive +- app/service/dispatcher.js (3) + - buildMap, getMethodMap, invoke +- app/service/main.js (11) + - success, fail, normalizeDate, setInfo, getInfo, findQimenAppWithContract, queryFromDatabase, checkAuth, checkApiPermission, setUserContext, systemInit +- app/service/pda.js (3) + - callMethod, validateParams, saveLog +- app/service/qimen.js (12) + - validateApi, getErpName, parseXmlToArray, cleanXmlString, callMethod, formatResponse, xmlResponse, buildXmlNode, escapeXml, saveQimenLog, saveQimenLogResult, saveQimenLogBody +- app/service/qimenMethods/deliveryorder.js (3) + - query, create, batchcreate +- app/service/qimenMethods/entryorder.js (2) + - create, query +- app/service/qimenMethods/inventory.js (1) + - query +- app/service/qimenMethods/order.js (2) + - cancel, pending +- app/service/qimenMethods/returnorder.js (2) + - create, query +- app/service/qimenMethods/singleitem.js (2) + - synchronize, query +- app/service/qimenMethods/stockout.js (2) + - create, query +- app/service/qimenMethods/taobao/qimen/service.js (1) + - heartbeat +- app/service/system.js (3) + - callMethod, validateParams, saveLog +- app/service/systemMethods/config.js (1) + - list +- app/service/systemMethods/dashboard.js (6) + - storeStats, warehouseStats, hot_order_rank, express_ratio, platform_distribution, order_trend +- app/service/systemMethods/index.js (13) + - fastWhereTree, loadStores, getCOSUploadConfig, getImages, uploadSuccessNotify, ReferenceFile, getMessageDetail, getI18nMessage, putI18nCollect, extractModule, tryAutoTranslateNewKeys, searchSpace, getExpressList +- app/service/systemMethods/order.js (11) + - getWarehouseId, getOrderModels, applyDateRange, buildWhere, parseDateTime, list, detail, listItems, stats, updateStatus, updateDeliveryTime +- app/service/systemMethods/print.js (3) + - send, sendToComputer, log +- app/service/systemMethods/printer/station.js (1) + - list +- app/service/systemMethods/setting/printTemplate.js (3) + - list, save, listTemplatesByType +- app/service/systemMethods/stock.js (21) + - stockWarehouse, getProhibitedType, getInfo, saveWarehouseStock, createWarehouseStock, getBarcodes, saveWarehouseStockBarcode, getStoreStocks, bindItem, unbindItem, checkItemCodeUnique, queryStockLogs, handleBatchDelete, deleteUnit, deleteProhibited, handleBatchChange, getStockUnits, getUnitList, createProhibited, createUnit, search +- app/service/systemMethods/storage/receiving.js (13) + - getReceivingList, getReceivingDetail, batchCancelReceiving, create, addItem, removeItem, saveReceiving, get, addDetail, deleteDetail, detailChange, cancel, completeReceiving +- app/service/systemMethods/store.js (6) + - createStore, createWarehouse, joinStore, joinWarehouse, getStoreRoles, auditApply +- app/service/systemMethods/user.js (5) + - login, logout, info, changeRole, register +- app/service/systemMethods/warehouse.js (20) + - getWarehouseZones, getWarehouseTree, getChildren, create, update, delete, detail, checkBarcodeUnique, toggleActive, getPath, createRack, getPickPath, updateRackPosition, recalculatePickPath, updateNeighbors, getAreaRacks, getSpacesByRack, createRackWithSpaces, getSpaceInfo, updateSpaceInfo +- app/service/systems/account_platform.js (8) + - switchActiveRole, getActiveRoleByPlatform, getMultiplePlatformActiveRoles, getAllPlatformActives, clearPlatformActive, clearPlatformCache, getAvailableRoles, getCurrentContext +- app/service/systems/auth/user.js (21) + - login, ID, changeRole, info, getRoles, findById, setUserCache, getAvatarByEmployeeId, clearUserCache, clearRelatedCache, getPermissions, getMenus, convertToRoutes, findUserByIdentifier, checkUserStatus, verifyPassword, encryptPassword, generateSalt, updateLastLoginTime, ensurePlatformActiveRole, register +- app/service/systems/delivery_order.js (7) + - addOrder, generateItemsHash, calculateCRC32, prepareOrderData, addOrderLines, safeParseFloat, addOrderToQueue +- app/service/systems/entry_order.js (9) + - addOrder, getLineCount, received, success, fail, tryCreateEntryOrder, addItems, qimenEntryorderConfirm, entryorderConfirm +- app/service/systems/fast_where.js (13) + - buildTree, getTreeByType, buildSubTree, getWithChildrenByType, getAllChildren, getByType, getGroups, getChildrenByPid, getTreeChildrenByPid, create, update, findById, delete +- app/service/systems/file.js (2) + - getImages, ReferenceFile +- app/service/systems/location_space.js (16) + - create, batchCreate, list, detail, update, delete, toggleStatus, updateStatus, findAvailableSpaces, findByCode, findByBarcode, getWarehouseStats, getZoneStats, validateAllocation, validateTransferOut, _validateReferences +- app/service/systems/location_zone.js (22) + - getWarehouseLevelZones, getZoneTreeByWarehouse, getChildrenByZoneId, isLeafNode, createZone, validateBasicFields, validateByZoneType, validateParentElement, validateZoneOverlap, isOverlap, generateZoneCodeByType, getDefaultColorByType, getZoneTypeText, updateZone, deleteZone, checkZoneOverlap, getZoneDetail, toggleZoneActive, getZonePath, generateSpacesForRack, getSpaceInfo, checkBarcodeUnique +- app/service/systems/location.js (10) + - createRackWithSpaces, _generateSpacesForRack, _calculateAreaRackOrder, _calculatePickPathForWarehouse, _updateSpacePickSequence, _calculatePickPriority, updateRackPosition, getPickPath, updateNeighborRelations, _findNeighborRacks +- app/service/systems/notification.js (1) + - send +- app/service/systems/operation_log.js (4) + - createOperationLog, queryStockLogs, queryOrderLogs, getMessageDetail +- app/service/systems/platform.js (6) + - checkPlatformExists, getPlatformInfo, clearPlatformCache, getPlatformSettingDetail, batchCheckPlatforms, createPlatformSetting +- app/service/systems/polo_api.js (6) + - getJsonDatas, getJsonData, getSignText, md5Encrypt, _formatDate, _formatPickupDate +- app/service/systems/print/index.js (2) + - sendToComputer, test +- app/service/systems/qimen_query.js (6) + - send, replaceXmlTagsWithString, addSign, getQueryParams, generateUrlWithParams, sendRequest +- app/service/systems/setting/print_template.js (14) + - listTemplatesByType, getTree, getTemplatesByType, save, getBusinessTypesAndItem, getGroupedPrintItems, getTableConfigs, clearBusinessTypesCache, getXmlByTemplate, buildXmlFromElements, renderElement, computeItemStyle, computeTableItemStyle, renderTable +- app/service/systems/sign.js (10) + - Constants, toXml, signTopRequest, verifyTopRequest, verifyAndExtractParams, generateSignedParams, encryptHMAC, encryptHMACSHA256, encryptMD5, byte2hex +- app/service/systems/space.js (1) + - searchSpace +- app/service/systems/stock_store.js (34) + - create, initQimenStockData, convertToQimenFormat, getItemInfoWithCache, getItemStorages, _calculateCacheTTL, clearItemStorageCache, lockItemStorages, ID, inbound, outbound, checkAndCreateWarehouseStock, getWarehouseStock, buildSequelizeCondition, processConditionValue, formatDate, isEmptyValue, getProhibitedType, getBarcodes, handleBatchChange, saveWarehouseStockBarcode, getStoreStocks, bindItem, unbindItem, getInfo, saveWarehouseStock, createWarehouseStock, validateSaveParams, stockLog, checkItemCodeUnique, handleBatchDelete, deleteUnit, deleteProhibited, search +- app/service/systems/storage/index.js (1) + - index +- app/service/systems/storage/receiving.js (16) + - getReceivingList, getReceivingDetail, batchCancelReceiving, isEmptyValue, buildSequelizeCondition, processConditionValue, create, get, addDetail, updateDetail, getStockStoreInfo, updateReceivingStats, deleteDetail, detailChange, invalid, completeReceiving +- app/service/systems/store.js (13) + - getStoreName, getStoreRemaskName, createStore, createWarehouse, joinStore, joinWarehouse, assignAdminRoleToCreator, generateJoinToken, sendNotification, sendNotificationToAdmins, getStoreRoles, auditApply, loadStores +- app/service/systems/upload.js (14) + - initCOS, getUploadParams, hash_hmac, validateFileInfo, generateFileName, parseSizeToBytes, formatFileSize, getFrontendConfig, uploadFile, validateFile, uploadSuccessNotify, getMimeType, createFileReference, handleUploadCallback + + + + + + diff --git a/AI_TOOLBOX.md b/AI_TOOLBOX.md new file mode 100644 index 0000000..eed5349 --- /dev/null +++ b/AI_TOOLBOX.md @@ -0,0 +1,170 @@ +# AI 工具箱(WMS) + +本文件用于统一 AI 协助开发/调试时可直接使用的方法,减少重复沟通成本。 + +## 1. 适用范围 + +- 项目根目录:D:\\wms +- 主要用途:本地调试、数据库取数、问题定位 +- 默认环境:PowerShell + Node.js + +## 2. 数据库调试脚本 + +项目已提供数据库查询脚本:`script/db-query.ps1` + +脚本能力: +- 自动读取 `config/config.local.js` 中的 `config.mysql.clients.` 配置 +- 执行传入 SQL 并返回 JSON +- 可选表格输出,便于命令行快速查看 + +### 2.1 基本用法 + +```powershell +powershell -ExecutionPolicy Bypass -File .\script\db-query.ps1 -Query "SELECT 1 AS ok" +``` + +### 2.2 常用示例 + +```powershell +# 查询最近 10 条账号 +powershell -ExecutionPolicy Bypass -File .\script\db-query.ps1 -Query "SELECT * FROM account ORDER BY id DESC LIMIT 10" + +# 表格输出 +powershell -ExecutionPolicy Bypass -File .\script\db-query.ps1 -Query "SELECT id, name FROM store LIMIT 20" -AsTable + +# 指定 mysql client(默认是 wms) +powershell -ExecutionPolicy Bypass -File .\script\db-query.ps1 -DbClient wms -Query "SHOW TABLES" +``` + +### 2.3 参数说明 + +- `-Query`:必填,SQL 语句 +- `-DbClient`:可选,MySQL 客户端名,默认 `wms` +- `-ConfigPath`:可选,配置文件路径,默认 `.\config\config.local.js`(相对于项目根目录) +- `-AsTable`:可选,按表格输出结果 + +### 2.4 返回结果说明 + +默认输出 JSON,结构如下: + +```json +{ + "client": "wms", + "rowCount": 1, + "rows": [ + { + "ok": 1 + } + ] +} +``` + +## 3. AI 协助时建议使用的提问模板 + +### 3.1 只读查询(推荐) + +```text +请在项目根目录执行 script/db-query.ps1,查询 SQL: +SELECT * FROM account LIMIT 20; +并把结果按表格给我,同时解释关键字段含义。 +``` + +### 3.2 先分析再查询 + +```text +请先阅读 app/model 下与 store 相关的模型,再使用 script/db-query.ps1 查询最近 50 条门店数据, +最后输出:1) 字段映射说明 2) 异常数据判断规则 3) 建议补充索引。 +``` + +### 3.3 联合排障 + +```text +请帮我排查某接口返回为空: +1) 找到对应 controller 和 service +2) 给出需要执行的 SQL +3) 使用 script/db-query.ps1 验证每一步 +4) 输出最终根因和修复建议 +``` + +## 4. 常见问题 + +- 报错 `Cannot find module 'mysql2/promise'` + - 先执行 `npm install`,确认依赖完整 + +- 报错 `MySQL client "xxx" not found in config.mysql.clients` + - 检查 `config/config.local.js` 中 `config.mysql.clients` 是否包含对应 client + +- 报错连接失败(超时/拒绝访问) + - 检查数据库 IP、端口、用户名密码、网络白名单 + +- PowerShell 执行策略限制 + - 使用命令中的 `-ExecutionPolicy Bypass`(仅本次命令生效) + +## 5. 安全约束 + +- 默认只执行 SELECT/SHOW 等只读 SQL +- 执行 UPDATE/DELETE 前必须先让 AI 生成影响范围确认 SQL(COUNT + WHERE 条件) +- 涉及生产数据时,优先在测试环境验证 + +## 6. 接口入口与 Method 指向 + +- 入口风格: + - `/qimen`:奇门开发接口(POST) + - `/system`:Web 端与 PDA 端统一接口(POST) + +- 外部请求示例: + - `http://127.0.0.1:6060/system?method=print.getComputerPrinter&v=1.0×tamp=1773386721` + +- Method 指向说明文档: + - 见 `AI_METHOD_ROUTING.md` + - 文档记录了 method 到 `app/service/systemMethods`、`app/service/qimenMethods` 的映射规则与示例。 + +## 7. methods 目录地图 + +目录:`methods/` + +- `methods/system.json` + - 作用:维护 `/system`(及 system 风格 method)的接口说明。 + - 覆盖内容:公共请求头、method 分组、params、response、errors。 + +- `methods/qimen.json` + - 作用:维护 `/qimen` 接口说明。 + - 覆盖内容:奇门 method、请求格式、响应格式、错误码。 + +建议将 `methods/*.json` 视为“接口文档单一事实来源(SSOT)”。 + +## 8. 接口变更联动工作流(强制) + +当出现以下任一变更时,必须同步更新 `methods` 目录下对应 JSON: + +1. 新增接口(新增 method) +2. 修改接口入参(新增/删除/重命名/必填变化) +3. 修改公共请求头(如 `platform`、`project`、`Authorization`) +4. 修改响应结构或错误码 + +执行步骤: + +1. 先改代码(controller/service/model) +2. 更新对应文档文件: + - system 入口改 `methods/system.json` + - qimen 入口改 `methods/qimen.json` +3. 若 system 入参有变化,执行参数结构化脚本刷新: + +```powershell +node .\script\tmp-struct-system-params.cjs +``` + +4. 人工补充自动脚本无法推断的信息: + - `description` + - `response` + - `errors` + - 特殊枚举值与业务约束 +5. 提交前自检: + - method 名称与代码一致 + - params 的 `name/type/required/source` 完整 + - 公共头部声明与实际鉴权逻辑一致 + +执行规则:接口代码与 `methods/*.json` 不一致时,以“必须补齐文档”为完成标准。 + + + \ No newline at end of file diff --git a/README.md b/README.md index 515189c..fef76b0 100644 --- a/README.md +++ b/README.md @@ -93,3 +93,13 @@ npm stop 如需二次开发或遇到问题,欢迎提 issue 或联系维护者。 [Egg.js 官方文档](https://eggjs.org) + +## AI 协作工具箱 + +- 见 `AI_TOOLBOX.md`,内含数据库调试脚本 `script/db-query.ps1` 的完整使用方法与 AI 提问模板。 +- 见 `AI_METHOD_ROUTING.md`,内含入口路由与 method 到代码文件的映射关系。 + +## 日报维护 + +- 日报统一记录在 `day.log`。 +- 每次更新日报内容时,需同步更新 `day.log` 文件,确保项目内留痕一致。 diff --git a/app/controller/docs.js b/app/controller/docs.js new file mode 100644 index 0000000..c612e21 --- /dev/null +++ b/app/controller/docs.js @@ -0,0 +1,965 @@ +const { + Controller, +} = require('egg'); +const fs = require('fs').promises; +const path = require('path'); + +function escapeHtml(value) { + return String(value || '') + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, '''); +} + +function toArray(value) { + return Array.isArray(value) ? value : []; +} + +function slugify(value) { + return String(value || '') + .toLowerCase() + .replace(/[^a-z0-9\u4e00-\u9fa5]+/g, '-') + .replace(/(^-|-$)/g, ''); +} + +function normalizeGroups(docData) { + if (docData && docData.methods && Array.isArray(docData.methods.groups)) { + return docData.methods.groups.map(group => ({ + groupName: group.groupName || group.module || 'Default', + module: group.module || '', + list: toArray(group.list), + })); + } + + if (docData && Array.isArray(docData.endpoints)) { + return [{ + groupName: 'Endpoints', + module: docData.module || '', + list: docData.endpoints, + }]; + } + + return []; +} + +function renderKeyValueRows(items, keyMap) { + if (!items.length) { + return '暂无数据'; + } + + return items.map(item => { + return ` + ${escapeHtml(item[keyMap.name] || '')} + ${escapeHtml(item[keyMap.type] || '')} + ${item[keyMap.required] ? '是' : '否'} + ${escapeHtml(item[keyMap.description] || '')} + `; + }).join(''); +} + +function renderGlobalHeadersControls(globalHeaders) { + const headers = toArray(globalHeaders); + if (!headers.length) { + return '

当前文档未定义额外全局 Header

'; + } + + return `
${headers.map(item => { + const name = item.name || ''; + const type = item.type || 'string'; + const required = !!item.required; + const description = item.description || ''; + const options = toArray(item.list); + + const field = options.length + ? `` + : ``; + + return ``; + }).join('')}
`; +} + +function renderMethodCard(item, entryPath, moduleName) { + const headers = toArray(item.headers); + const params = toArray(item.params); + const response = toArray(item.response); + const errors = toArray(item.errors); + const methodName = item.method || item.name || 'unknown'; + const description = item.description || ''; + const isQimen = moduleName === 'qimen'; + const queryHint = isQimen + ? 'app_key=xxx&method=...&v=2.0&format=json&sign_method=md5&sign=xxx×tamp=1700000000' + : `method=${methodName}&v=1.0×tamp=1700000000`; + + return `
+
+
+

${escapeHtml(methodName)}

+

${escapeHtml(description)}

+
+
+ 入口: ${escapeHtml(entryPath)} + 鉴权: ${item.isNeedAuth ? '是' : '否'} + 登录: ${item.isNeedLogin ? '是' : '否'} +
+
+ +
+ Headers (${headers.length}) + + + ${renderKeyValueRows(headers, { + name: 'name', + type: 'type', + required: 'required', + description: 'description', + })} +
名称类型必填说明
+
+ +
+ Params (${params.length}) + + + ${renderKeyValueRows(params, { + name: 'name', + type: 'type', + required: 'required', + description: 'description', + })} +
名称类型必填说明
+
+ +
+ Response (${response.length}) + + + ${renderKeyValueRows(response, { + name: 'name', + type: 'type', + required: 'required', + description: 'description', + })} +
名称类型必填说明
+
+ +
+ Errors (${errors.length}) + + + ${renderKeyValueRows(errors, { + name: 'code', + type: 'type', + required: 'required', + description: 'message', + })} +
名称类型必填说明
+
+ +
+ 在线调试 +
+ + + + + + +
+ + ${item.isNeedLogin ? '该接口需要登录,未设置 Token 将阻止请求' : '该接口无需登录,可不设置 Token 直接调试'} +
+ +
点击发送后显示响应
+
+
+
`; +} + +function renderHtmlPage({ + docName, + docData, + groups, + docs, + entryPath, +}) { + const methodsCount = groups.reduce((sum, group) => sum + toArray(group.list).length, 0); + const globalHeaders = toArray(docData.headers); + const globalHeadersControls = renderGlobalHeadersControls(globalHeaders); + const navHtml = docs.map(name => { + const activeClass = name === docName ? 'active' : ''; + return `${escapeHtml(name)}`; + }).join(''); + + const sidebarHtml = groups.map((group, index) => { + const list = toArray(group.list); + const groupKey = slugify(group.module || group.groupName || `group-${index}`) || `group-${index}`; + const methodsHtml = list.map(item => { + const methodName = item.method || item.name || 'unknown'; + const desc = item.description || ''; + return ``; + }).join(''); + + return ``; + }).join(''); + + const groupHtml = groups.map(group => { + const list = toArray(group.list); + const groupKey = slugify(group.module || group.groupName) || 'group'; + const cards = list.map(item => renderMethodCard(item, entryPath, docData.module)).join(''); + return `
+

${escapeHtml(group.groupName)} ${escapeHtml(group.module || '')}

+ ${cards || '

该分组暂无方法定义

'} +
`; + }).join(''); + + return ` + + + + + ${escapeHtml(docName)} API 文档 + + + +
+
+

${escapeHtml(docData.module || docName)} API 文档

+
+ 说明: ${escapeHtml(docData.description || '无')} + 版本: ${escapeHtml(docData.version || 'N/A')} + 更新: ${escapeHtml(docData.updatedAt || 'N/A')} + 方法数: ${methodsCount} + 统一入口: ${escapeHtml(entryPath)} +
+
+ ${navHtml} + 查看 JSON +
+
+

全局 Authorization

+
+ + +
+

设置后会自动注入所有“在线调试”请求头,保存在浏览器本地。

+

全局业务 Header

+ ${globalHeadersControls} +

来自 JSON 的 headers 定义;带 * 的字段为必填,支持下拉 list 选择。

+
+
+ +
+ + +
+ ${groupHtml || '

暂无可展示的方法定义

'} +
+
+
+ + +`; +} + +class DocsController extends Controller { + async list() { + const { ctx } = this; + try { + const docs = await this.getDocNames(); + if (!docs.length) { + ctx.status = 404; + ctx.body = { + code: 404, + message: 'methods 目录下没有可用的 JSON 文档', + }; + return; + } + + const fallback = docs.includes('system') ? 'system' : docs[0]; + await this.renderDoc(fallback); + } catch (error) { + ctx.status = 500; + ctx.body = { + code: 500, + message: '读取文档失败', + error: error.message, + }; + } + } + + async api() { + await this.list(); + } + + async detail() { + const { ctx } = this; + const docName = ctx.params.docName; + await this.renderDoc(docName); + } + + async raw() { + const { ctx } = this; + const docName = ctx.params.docName; + + if (!/^[a-zA-Z0-9_-]+$/.test(docName || '')) { + ctx.status = 400; + ctx.body = { code: 400, message: '无效文档名' }; + return; + } + + const filePath = path.join(this.app.baseDir, 'methods', `${docName}.json`); + + try { + const content = await fs.readFile(filePath, 'utf8'); + ctx.type = 'application/json; charset=utf-8'; + ctx.body = content; + } catch (error) { + ctx.status = 404; + ctx.body = { + code: 404, + message: `未找到文档: ${docName}`, + }; + } + } + + async getDocNames() { + const docsDir = path.join(this.app.baseDir, 'methods'); + const entries = await fs.readdir(docsDir, { withFileTypes: true }); + + return entries + .filter(entry => entry.isFile() && entry.name.endsWith('.json')) + .map(entry => entry.name.replace(/\.json$/i, '')) + .sort(); + } + + async renderDoc(docName) { + const { ctx, app } = this; + + if (!/^[a-zA-Z0-9_-]+$/.test(docName || '')) { + ctx.status = 400; + ctx.body = { code: 400, message: '无效文档名' }; + return; + } + + const filePath = path.join(app.baseDir, 'methods', `${docName}.json`); + + try { + const [ content, docs ] = await Promise.all([ + fs.readFile(filePath, 'utf8'), + this.getDocNames(), + ]); + + const docData = JSON.parse(content); + const groups = normalizeGroups(docData); + const entryPath = docData.module === 'qimen' ? '/qimen' : '/system'; + const html = renderHtmlPage({ + docName, + docData, + groups, + docs, + entryPath, + }); + + ctx.type = 'text/html; charset=utf-8'; + ctx.body = html; + } catch (error) { + ctx.status = 404; + ctx.body = { + code: 404, + message: `未找到文档或 JSON 格式错误: ${docName}`, + error: error.message, + }; + } + } +} + +module.exports = DocsController; \ No newline at end of file diff --git a/app/model/order_delivery.js b/app/model/order_delivery.js index 3b654ae..35d84c0 100644 --- a/app/model/order_delivery.js +++ b/app/model/order_delivery.js @@ -119,6 +119,11 @@ module.exports = app => { allowNull: true, comment: 'ERP审核时间', }, + delivery_time: { + type: DATE, + allowNull: true, + comment: '发货时间', + }, shop_nick: { type: STRING(200), allowNull: true, diff --git a/app/model/order_delivery_factory.js b/app/model/order_delivery_factory.js index 27a217d..a5df849 100644 --- a/app/model/order_delivery_factory.js +++ b/app/model/order_delivery_factory.js @@ -294,6 +294,7 @@ module.exports = app => { \`service_code\` varchar(50) DEFAULT NULL COMMENT '集包服务编码', \`operator_name\` varchar(50) DEFAULT NULL COMMENT 'ERP审核人', \`operate_time\` datetime DEFAULT NULL COMMENT 'ERP审核时间', + \`delivery_time\` datetime DEFAULT NULL COMMENT '发货时间', \`shop_nick\` varchar(200) DEFAULT NULL COMMENT '店铺名称', \`seller_nick\` varchar(200) DEFAULT NULL COMMENT '卖家名称', \`buyer_nick\` varchar(200) DEFAULT NULL COMMENT '买家名称', diff --git a/app/router.js b/app/router.js index ec0efb8..af886dc 100644 --- a/app/router.js +++ b/app/router.js @@ -10,6 +10,9 @@ module.exports = app => { router.post('/api/v1', controller.home.v1); router.post('/system', controller.home.system); router.post('/api/v2', controller.apiV2.index); + router.get('/api/docs', controller.docs.list); + router.get('/api/docs/:docName', controller.docs.detail); + router.get('/api/docs/:docName/raw', controller.docs.raw); router.get('/template/xml/:id', controller.template.xml); router.get('/auth/printSetting/:code', controller.auth.printerSetting); router.get('/testSendData', controller.home.testSendData); diff --git a/app/service/systemMethods/order.js b/app/service/systemMethods/order.js new file mode 100644 index 0000000..8cc17d8 --- /dev/null +++ b/app/service/systemMethods/order.js @@ -0,0 +1,351 @@ +'use strict'; + +const MainService = require('../main'); + +class orderService extends MainService { + constructor(ctx) { + super(ctx); + const _noNeedLogin = ''; + const _noNeedRight = 'list,detail,listItems,stats,updateStatus,updateDeliveryTime'; + const _noNeedLog = 'list,detail,listItems,stats'; + const _noNeedAuth = 'list,detail,listItems,stats,updateStatus,updateDeliveryTime'; + this.systemInit(_noNeedLogin, _noNeedRight, _noNeedLog, _noNeedAuth); + } + + getWarehouseId(data = {}) { + const fromParam = Number(data.warehouse_id || data.warehouseId || 0); + const fromUser = Number(this.ctx.user?.store_id || 0); + return fromParam || fromUser; + } + + async getOrderModels(warehouseId) { + const DeliveryModel = await this.ctx.model.OrderDeliveryFactory.getCurrentModel(warehouseId); + const OrderItemsModel = await this.ctx.model.OrderItemsFactory.getCurrentModel(warehouseId); + return { DeliveryModel, OrderItemsModel }; + } + + applyDateRange(where, field, start, end) { + const { Op } = this.app.Sequelize; + const range = {}; + + if (start) { + range[Op.gte] = this.normalizeDate(start, false); + } + if (end) { + range[Op.lte] = this.normalizeDate(end, true); + } + + if (Object.keys(range).length > 0) { + where[field] = range; + } + } + + buildWhere(whereData = {}, warehouseId) { + const { Op } = this.app.Sequelize; + const where = { warehouse_id: warehouseId }; + + const eqFields = [ + 'id', + 'store_id', + 'status', + 'post_status', + 'storage_status', + 'pick_status', + 'pack_status', + 'inspection_status', + 'print_status', + 'claim_status', + 'outbound_status', + 'lock_status', + 'intercept_status', + 'source_platform_code', + 'logistics_code', + 'warehouse_code', + 'order_type', + ]; + + for (const key of eqFields) { + if (whereData[key] !== undefined && whereData[key] !== null && whereData[key] !== '') { + where[key] = whereData[key]; + } + } + + if (whereData.delivery_order_code) { + where.delivery_order_code = { [Op.like]: `%${whereData.delivery_order_code}%` }; + } + + if (Array.isArray(whereData.delivery_order_codes) && whereData.delivery_order_codes.length > 0) { + where.delivery_order_code = { [Op.in]: whereData.delivery_order_codes }; + } + + if (whereData.logistics_name) { + where.logistics_name = { [Op.like]: `%${whereData.logistics_name}%` }; + } + + if (whereData.buyer_nick) { + where.buyer_nick = { [Op.like]: `%${whereData.buyer_nick}%` }; + } + + if (whereData.mobile) { + where.mobile = { [Op.like]: `%${whereData.mobile}%` }; + } + + this.applyDateRange(where, 'create_at', whereData.create_at_start, whereData.create_at_end); + this.applyDateRange(where, 'place_order_time', whereData.place_order_time_start, whereData.place_order_time_end); + this.applyDateRange(where, 'pay_time', whereData.pay_time_start, whereData.pay_time_end); + this.applyDateRange(where, 'delivery_time', whereData.delivery_time_start, whereData.delivery_time_end); + + return where; + } + + parseDateTime(value, fieldName) { + if (!value) return null; + const d = value instanceof Date ? value : new Date(value); + if (Number.isNaN(d.getTime())) { + throw new Error(`${fieldName} 格式错误`); + } + return d; + } + + async list(data = {}) { + try { + const warehouseId = this.getWarehouseId(data); + if (!warehouseId) { + return this.fail('warehouse_id 不能为空', { code: 400 }); + } + + const { DeliveryModel } = await this.getOrderModels(warehouseId); + const where = this.buildWhere(data.where || {}, warehouseId); + + const page = Math.max(Number(data.pagination?.page || 1), 1); + const pageSize = Math.min(Math.max(Number(data.pagination?.pageSize || 20), 1), 200); + const offset = (page - 1) * pageSize; + + const result = await DeliveryModel.findAndCountAll({ + where, + offset, + limit: pageSize, + order: [ [ 'updated_at', 'DESC' ], [ 'id', 'DESC' ] ], + raw: true, + }); + + return this.success('ok', { + data: { + list: result.rows, + pagination: { + page, + pageSize, + total: result.count, + totalPages: Math.ceil(result.count / pageSize), + hasNext: page * pageSize < result.count, + hasPrevious: page > 1, + }, + }, + code: 200, + }); + } catch (error) { + return this.fail(error.message, { code: 500 }); + } + } + + async detail(data = {}) { + try { + const warehouseId = this.getWarehouseId(data); + if (!warehouseId) { + return this.fail('warehouse_id 不能为空', { code: 400 }); + } + + const { DeliveryModel, OrderItemsModel } = await this.getOrderModels(warehouseId); + const where = { warehouse_id: warehouseId }; + + if (data.id) { + where.id = data.id; + } else if (data.delivery_order_code) { + where.delivery_order_code = data.delivery_order_code; + } else { + return this.fail('id 或 delivery_order_code 必填', { code: 400 }); + } + + const order = await DeliveryModel.findOne({ where, raw: true }); + if (!order) { + return this.fail('订单不存在', { code: 404 }); + } + + const items = await OrderItemsModel.findAll({ + where: { order_id: order.id }, + order: [ [ 'id', 'ASC' ] ], + raw: true, + }); + + return this.success('ok', { + data: { + order, + items, + }, + code: 200, + }); + } catch (error) { + return this.fail(error.message, { code: 500 }); + } + } + + async listItems(data = {}) { + try { + const warehouseId = this.getWarehouseId(data); + if (!warehouseId) { + return this.fail('warehouse_id 不能为空', { code: 400 }); + } + + const { DeliveryModel, OrderItemsModel } = await this.getOrderModels(warehouseId); + const where = { warehouse_id: warehouseId }; + + if (data.order_id) { + where.id = data.order_id; + } else if (data.delivery_order_code) { + where.delivery_order_code = data.delivery_order_code; + } else { + return this.fail('order_id 或 delivery_order_code 必填', { code: 400 }); + } + + const order = await DeliveryModel.findOne({ where, attributes: [ 'id', 'delivery_order_code' ], raw: true }); + if (!order) { + return this.fail('订单不存在', { code: 404 }); + } + + const items = await OrderItemsModel.findAll({ + where: { order_id: order.id }, + order: [ [ 'id', 'ASC' ] ], + raw: true, + }); + + return this.success('ok', { + data: { + order, + items, + }, + code: 200, + }); + } catch (error) { + return this.fail(error.message, { code: 500 }); + } + } + + async stats(data = {}) { + try { + const warehouseId = this.getWarehouseId(data); + if (!warehouseId) { + return this.fail('warehouse_id 不能为空', { code: 400 }); + } + + const { Sequelize } = this.app; + const { DeliveryModel } = await this.getOrderModels(warehouseId); + const where = this.buildWhere(data.where || {}, warehouseId); + + const total = await DeliveryModel.count({ where }); + const byStatusRows = await DeliveryModel.findAll({ + where, + attributes: [ 'status', [ Sequelize.fn('COUNT', Sequelize.col('id')), 'count' ] ], + group: [ 'status' ], + raw: true, + }); + + const byOutboundRows = await DeliveryModel.findAll({ + where, + attributes: [ 'outbound_status', [ Sequelize.fn('COUNT', Sequelize.col('id')), 'count' ] ], + group: [ 'outbound_status' ], + raw: true, + }); + + return this.success('ok', { + data: { + total, + byStatus: byStatusRows, + byOutboundStatus: byOutboundRows, + }, + code: 200, + }); + } catch (error) { + return this.fail(error.message, { code: 500 }); + } + } + + async updateStatus(data = {}) { + try { + const warehouseId = this.getWarehouseId(data); + if (!warehouseId) { + return this.fail('warehouse_id 不能为空', { code: 400 }); + } + + const { DeliveryModel } = await this.getOrderModels(warehouseId); + const where = { warehouse_id: warehouseId }; + + if (data.id) { + where.id = data.id; + } else if (data.delivery_order_code) { + where.delivery_order_code = data.delivery_order_code; + } else { + return this.fail('id 或 delivery_order_code 必填', { code: 400 }); + } + + const allowedFields = [ + 'status', + 'post_status', + 'storage_status', + 'pick_status', + 'pack_status', + 'inspection_status', + 'print_status', + 'claim_status', + 'outbound_status', + 'lock_status', + 'intercept_status', + ]; + + const updateData = {}; + for (const key of allowedFields) { + if (data[key] !== undefined && data[key] !== null && data[key] !== '') { + updateData[key] = data[key]; + } + } + + if (data.delivery_time) { + updateData.delivery_time = this.parseDateTime(data.delivery_time, 'delivery_time'); + } + + if (!updateData.delivery_time && updateData.outbound_status === 'fin') { + updateData.delivery_time = new Date(); + } + + if (Object.keys(updateData).length === 0) { + return this.fail('没有可更新字段', { code: 400 }); + } + + updateData.updated_at = new Date(); + + const [ affected ] = await DeliveryModel.update(updateData, { where }); + if (!affected) { + return this.fail('订单不存在或未更新', { code: 404 }); + } + + const order = await DeliveryModel.findOne({ where, raw: true }); + return this.success('更新成功', { data: order, code: 200 }); + } catch (error) { + return this.fail(error.message, { code: 500 }); + } + } + + async updateDeliveryTime(data = {}) { + if (!data.delivery_time) { + return this.fail('delivery_time 必填', { code: 400 }); + } + + const nextData = { ...data }; + if (nextData.syncOutboundStatus === true || nextData.syncOutboundStatus === 1 || nextData.syncOutboundStatus === '1') { + nextData.outbound_status = 'fin'; + } + + return await this.updateStatus(nextData); + } +} + +module.exports = orderService; diff --git a/database/migrations/20260322061000-add-delivery-time-to-order-delivery-tables.js b/database/migrations/20260322061000-add-delivery-time-to-order-delivery-tables.js new file mode 100644 index 0000000..b8e70d1 --- /dev/null +++ b/database/migrations/20260322061000-add-delivery-time-to-order-delivery-tables.js @@ -0,0 +1,63 @@ +'use strict'; + +module.exports = { + async up(queryInterface) { + const [ tables ] = await queryInterface.sequelize.query(` + SELECT TABLE_NAME + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA = DATABASE() + AND (TABLE_NAME = 'wms_order_delivery' OR TABLE_NAME LIKE 'wms_order_delivery\\_%') + `); + + for (const row of tables) { + const tableName = row.TABLE_NAME; + + const [ columns ] = await queryInterface.sequelize.query( + ` + SELECT COLUMN_NAME + FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_SCHEMA = DATABASE() + AND TABLE_NAME = :tableName + AND COLUMN_NAME = 'delivery_time' + `, + { replacements: { tableName } } + ); + + if (columns.length === 0) { + await queryInterface.sequelize.query( + `ALTER TABLE \`${tableName}\` ADD COLUMN \`delivery_time\` datetime NULL DEFAULT NULL COMMENT '发货时间' AFTER \`operate_time\`` + ); + } + } + }, + + async down(queryInterface) { + const [ tables ] = await queryInterface.sequelize.query(` + SELECT TABLE_NAME + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA = DATABASE() + AND (TABLE_NAME = 'wms_order_delivery' OR TABLE_NAME LIKE 'wms_order_delivery\\_%') + `); + + for (const row of tables) { + const tableName = row.TABLE_NAME; + + const [ columns ] = await queryInterface.sequelize.query( + ` + SELECT COLUMN_NAME + FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_SCHEMA = DATABASE() + AND TABLE_NAME = :tableName + AND COLUMN_NAME = 'delivery_time' + `, + { replacements: { tableName } } + ); + + if (columns.length > 0) { + await queryInterface.sequelize.query( + `ALTER TABLE \`${tableName}\` DROP COLUMN \`delivery_time\`` + ); + } + } + }, +}; diff --git a/day.log b/day.log index ac9fd71e43bff43c44d71e795183797f091ddc9d..f5f97845641408533f9ece5f51b2b0cda32c46df 100644 GIT binary patch literal 6188 zcmb_gZEREL6@E?DG+B(tIt^`B5jQ_JvVw_2r!rEl8igoLA=lW~`H~Ym@y+!INt}?x zH>3!steKk34oONA0%a5?Q2DiGnl_33*{D#eF;##l2&rn>mStjNBom4<0fM{p+&AW4 zn*^9NS^j?CbIyCtbDnd~t3BMroNN<&g*oW`WqRF2kCp7J>_*~ba$4#S*fl9o>6vM$ zca=(|qQJr|%DS1ru84>HR&7Qs5P#x6>&usq`^v^I$)`k{_^z@bUYF)W-AZov3MXXY z$wZ6uf;gk3e5-=#-y9_8l6+0N71$9hX1iEBYh}G`D}Ab9KMLlD?^Pf5RgT8`oF0M6 z^lyxXNPCzSvkrZ2J8Pm(QMQroW?jsxU6RWste+Zph$r{uc0YLg0}r<@)-v9Gtm2}tF zl!6?KGfbywXU$}l#o0-kU~iNxhfa$V=ZMk2_$IK5eO>O2W7vDY?S$v=$*IK6)(fL4 zZ-MxHB=n=QTJan?HY&)x@_l@LwmXWMdkiMe)tSzqr~P zt=bo^b4i>Dn4FUy4F57_$evV=*KUc-s#SpwB_<#8=cKMC?FTl51v*=hvSAM)1itH~ z^LCJrOX$SKibcMkye4I1(u~lJgyeRLMH9VqbPB9rh0Vax9{Lr#Tj>Od5AsR%hl4u@ zfEG8~N#CzY9g1NmvSxXk1m=A^CuI}oq@wt`#?;YsNvn3J!9McIFyxhyyfU_pc}Z#s zJ-59zJz#0Ojd(8gB?3^BVT&yE%D z?jtO6AHsh{@vE&i5s@xaj*Y)3&x8#PMKwzyiEODoK^X|mT<%OmkNa2q6!)}b)hfqD zm(6=S!7&2sV-z3ceh{$QwhdIkPxJ+-dlhYc-u5dwyJ(AD&bSch}Ug!xy9l1$*CB{889s_!EQr!ypzC-tM6Csx{IuYwL zbaJkX(b>Q+0%Z$c&nj<37L@W4uxX7RnPytiL#XFkT8AsBMt~=#2S>tbZCgm!_r(Q8 zAe6~En+t3`?U2cb3RwW=_0SXf7}bA+rmqEFe(R_YdBd$jl=CU-@Y%`a3m$XSE%NO| z%GY1@WOiNTvqzD<6?kC;(aPlLUq^DgRX?IIAF|g~N!#2z+OAU0q5iB4Q*3w5)|%P# zN+ORi(M;z6kANA#TF9gM(D}ifcly;C<#Z4^WU%3b;g=2?zJ~rMWhK}Jb{hNvX?far zhyEj3oHxe~`z_8x{#u{KiRzKBss3PKRq*-9l>0sT*!b4Ag0~D0eqL>HN`V<2Wyqa8 z?X)~C*+lFF2JZ|RAIyy70O14%dEWu z13Oza*gGf9tEc6hR8hQN*Ecoz(8OG@1U5znP>Vimx$CoQe++`BdkDQ<#AofKgV(}< z{to`-m9m#~7t?d8mFRbP-OpUZnH#miELmU|B&vRmxgKtZm3)m;wUKt{Mz(<^R*m#d z-1UX`7%>L(A_vfGZEZt-+r%r0W8sg)Xs2EGc|PTsK-RQTRys_lanR{xJ)7GIV-7k6 zPTE4e1FZEdGIySaI78;|l01gbDi4(nI>ELINkg{<2F}yqXn;z0dAU5Cc`CWyqxxfePbFUzE=%i%7L@rhc(Jsvq;8D>7O`uuije`E z2)~!tfZJ`M*k1Em!_z>D`5$Fq*N0{gn`6bR5|5mLmHtRa z|CxOSyxj9gOx6GYuQfnuXd;w!>$ZW15Jj^Uyz--~3R9fHxlujJb}c<4U_!ur;G}t> zgkJG*(8^|dI3CL=$0Hx%Q+pO-vptG6O;poc$){b5*6Dms`vi8U;jVA8D?c0=0NW#8 zsvmt0dK|m9RMuw8w>Y0=Rp8ONa5jOJ*VOvZuVhOz;$KAn@%ofT#P{@h2Uhd0jdwKQ zP;|n`>(!DOZRU;(owb*}LH*WtViga)SJC$hCbIIyET)cta1AEfvxvYLX#&G!PASxb zQ0H_zSwZy>IPKQwon~4qguYULe(>9#3sPxs(q;H~J~T=7cPW-O_xg}JpR|Rj+gv=& z!}m|ikdi)e#C>t}aTd?C0oCHVdbY!^wFEE9%gtQ^D-a{@o7C%P*96R%s{e>vp^l$h z{B+L=3_aa*u_~!ls;M#9fcxJ(;R!5V>x}Hqv>?;hl_vjUIyCA`I?K=-eBi>gj7ngR z20UR#gLyCN6Q)ihM&^HkN#snFa%Slj>HQV7j#sdy*Fgs`+_j9HIB|a(<m(`vCIBrq_cW_(aoi=xNe}+@ww#7#GE2o3FRp7ji z)$rq;hTM7`XS5D?BbZ^(pQCH&B>Orjrs+NlC%us%t0>P)MKdzZtBdI@OV7v9$@_}T z_35tVf9(gJCNE4rjnOGH^V5-$Wez%HOz-qCYa@qH|M;BoH2G%iqt-=9mpOwSB#n2l zd8SGeic|lHLz-QKPY1E!kryv8UwF6l;e-j6TH90 z+=(7?HO(Z51fK93I2owND%6>5mgJm`$x^1s3+yBL6;FijuhMrjm`Kw5am&Q5;ke{` z%k@f&s>$yVf#|d}XtZiY@q;2VVJ2MAla^)pmP;`s0d`=D&6Dcyld7D+Q0E~# zU5B5|QgbB0HJEUolh)IGTtc0tz+R#b{(QpXM1Q$i|DIhjo5HiI5r?T+3HTw delta 15 XcmZ2uu#0oUAEwDSSl&!N$94$-JmUxA diff --git a/methods/qimen.json b/methods/qimen.json new file mode 100644 index 0000000..01b7464 --- /dev/null +++ b/methods/qimen.json @@ -0,0 +1,7 @@ +{ + "module": "qimen", + "description": "Qimen API method catalog", + "version": "0.1.0", + "updatedAt": "2026-03-22", + "endpoints": [] +} diff --git a/methods/system.json b/methods/system.json new file mode 100644 index 0000000..6436e3b --- /dev/null +++ b/methods/system.json @@ -0,0 +1,2896 @@ +{ + "module": "system", + "description": "系统接口标准入口,method 对应系统内置方法,全部使用 POST 请求,参数统一放在 body 内", + "version": "0.3.0", + "updatedAt": "2026-03-22", + "headers": [ + { + "name": "platform", + "type": "string", + "required": true, + "description": "客户端平台标识,如 web/pda/app", + "list":[ + {"value":"web","name":"网页端"}, + {"value":"pda","name":"PDA端"}, + {"value":"app","name":"APP端"}, + {"value":"wx","name":"微信端"}, + {"value":"miniProgram","name":"小程序端"}, + {"value":"other","name":"其他"} + ] + }, + { + "type":"string", + "required":true, + "name":"project", + "description":"项目标识,如 wms", + "list":[ + {"value":"all","name":"所有系统"}, + {"value":"wms","name":"仓库管理系统"}, + {"value":"tms","name":"运输管理系统"}, + {"value":"scm","name":"供应链管理系统"}, + {"value":"other","name":"其他"} + ] + } + ], + "methods": { + "groups": [ + { + "groupName": "配置模块", + "module": "config", + "list": [ + { + "method": "config.list", + "description": "config.list 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + } + ] + }, + { + "groupName": "看板模块", + "module": "dashboard", + "list": [ + { + "method": "dashboard.storeStats", + "description": "dashboard.storeStats 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "dashboard.warehouseStats", + "description": "dashboard.warehouseStats 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "dashboard.hot_order_rank", + "description": "dashboard.hot_order_rank 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "dashboard.express_ratio", + "description": "dashboard.express_ratio 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "dashboard.platform_distribution", + "description": "dashboard.platform_distribution 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "dashboard.order_trend", + "description": "dashboard.order_trend 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + } + ] + }, + { + "groupName": "基础模块", + "module": "index", + "list": [ + { + "method": "index.fastWhereTree", + "description": "index.fastWhereTree 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "type", + "type": "string", + "required": false, + "source": "body", + "description": "type 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "index.loadStores", + "description": "index.loadStores 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "index.getCOSUploadConfig", + "description": "index.getCOSUploadConfig 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "data", + "type": "object", + "required": false, + "source": "body", + "description": "data 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "index.getImages", + "description": "index.getImages 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "index.uploadSuccessNotify", + "description": "index.uploadSuccessNotify 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "index.ReferenceFile", + "description": "index.ReferenceFile 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "index.getMessageDetail", + "description": "index.getMessageDetail 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "index.getI18nMessage", + "description": "index.getI18nMessage 接口", + "isNeedAuth": false, + "isNeedLogin": false, + "headers": [], + "params": [ + { + "name": "language", + "type": "string", + "required": false, + "source": "body|query", + "description": "language 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "index.putI18nCollect", + "description": "index.putI18nCollect 接口", + "isNeedAuth": false, + "isNeedLogin": false, + "headers": [], + "params": [ + { + "name": "keys", + "type": "array", + "required": false, + "source": "body", + "description": "keys 参数" + }, + { + "name": "locale", + "type": "string", + "required": false, + "source": "body", + "description": "locale 参数" + }, + { + "name": "project", + "type": "string", + "required": false, + "source": "body", + "description": "project 参数" + }, + { + "name": "source", + "type": "string", + "required": false, + "source": "body", + "description": "source 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "index.tryAutoTranslateNewKeys", + "description": "index.tryAutoTranslateNewKeys 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "index.searchSpace", + "description": "index.searchSpace 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "index.getExpressList", + "description": "index.getExpressList 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + } + ] + }, + { + "groupName": "订单模块", + "module": "order", + "list": [ + { + "method": "order.getOrderModels", + "description": "order.getOrderModels 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "order.list", + "description": "分页查询订单列表", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "pagination", + "type": "object", + "required": false, + "source": "body", + "description": "pagination 参数" + }, + { + "name": "where", + "type": "object", + "required": false, + "source": "body", + "description": "where 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "order.detail", + "description": "查询订单详情", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "delivery_order_code", + "type": "string", + "required": false, + "source": "body", + "description": "delivery_order_code 参数" + }, + { + "name": "id", + "type": "number", + "required": false, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "order.listItems", + "description": "查询订单商品明细", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "delivery_order_code", + "type": "string", + "required": false, + "source": "body", + "description": "delivery_order_code 参数" + }, + { + "name": "order_id", + "type": "number", + "required": false, + "source": "body", + "description": "order_id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "order.stats", + "description": "订单统计", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "where", + "type": "object", + "required": false, + "source": "body", + "description": "where 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "order.updateStatus", + "description": "更新订单状态", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "claim_status", + "type": "string", + "required": false, + "source": "body", + "description": "claim_status 参数" + }, + { + "name": "delivery_order_code", + "type": "string", + "required": false, + "source": "body", + "description": "delivery_order_code 参数" + }, + { + "name": "delivery_time", + "type": "string", + "required": false, + "source": "body", + "description": "delivery_time 参数" + }, + { + "name": "id", + "type": "number", + "required": false, + "source": "body", + "description": "id 参数" + }, + { + "name": "inspection_status", + "type": "string", + "required": false, + "source": "body", + "description": "inspection_status 参数" + }, + { + "name": "intercept_status", + "type": "string", + "required": false, + "source": "body", + "description": "intercept_status 参数" + }, + { + "name": "lock_status", + "type": "string", + "required": false, + "source": "body", + "description": "lock_status 参数" + }, + { + "name": "outbound_status", + "type": "string", + "required": false, + "source": "body", + "description": "outbound_status 参数" + }, + { + "name": "pack_status", + "type": "string", + "required": false, + "source": "body", + "description": "pack_status 参数" + }, + { + "name": "pick_status", + "type": "string", + "required": false, + "source": "body", + "description": "pick_status 参数" + }, + { + "name": "post_status", + "type": "string", + "required": false, + "source": "body", + "description": "post_status 参数" + }, + { + "name": "print_status", + "type": "string", + "required": false, + "source": "body", + "description": "print_status 参数" + }, + { + "name": "status", + "type": "string", + "required": false, + "source": "body", + "description": "status 参数" + }, + { + "name": "storage_status", + "type": "string", + "required": false, + "source": "body", + "description": "storage_status 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "order.updateDeliveryTime", + "description": "更新发货时间", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "delivery_time", + "type": "string", + "required": true, + "source": "body", + "description": "delivery_time 参数" + } + ], + "response": [], + "errors": [] + } + ] + }, + { + "groupName": "打印模块", + "module": "print", + "list": [ + { + "method": "print.send", + "description": "print.send 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "computerId", + "type": "string", + "required": false, + "source": "body", + "description": "computerId 参数" + }, + { + "name": "count", + "type": "number", + "required": false, + "source": "body", + "description": "count 参数" + }, + { + "name": "data", + "type": "object", + "required": false, + "source": "body", + "description": "data 参数" + }, + { + "name": "printer", + "type": "string", + "required": false, + "source": "body", + "description": "printer 参数" + }, + { + "name": "template", + "type": "object", + "required": false, + "source": "body", + "description": "template 参数" + }, + { + "name": "timestamp", + "type": "string", + "required": false, + "source": "body", + "description": "timestamp 参数" + }, + { + "name": "type", + "type": "string", + "required": false, + "source": "body", + "description": "type 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "print.getPrintResult", + "description": "print.getPrintResult 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "printId", + "type": "string", + "required": true, + "source": "body", + "description": "printId 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "print.getPrintRecordItem", + "description": "print.getPrintRecordItem 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "print.getList", + "description": "print.getList 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "page", + "type": "number", + "required": false, + "source": "body", + "description": "page 参数" + }, + { + "name": "pageSize", + "type": "number", + "required": false, + "source": "body", + "description": "pageSize 参数" + }, + { + "name": "where", + "type": "object", + "required": false, + "source": "body", + "description": "where 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "print.getItem", + "description": "print.getItem 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "print.add", + "description": "print.add 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "computer_id", + "type": "number", + "required": true, + "source": "body", + "description": "computer_id 参数" + }, + { + "name": "name", + "type": "string", + "required": true, + "source": "body", + "description": "name 参数" + }, + { + "name": "custom_barcode", + "type": "string", + "required": false, + "source": "body", + "description": "custom_barcode 参数" + }, + { + "name": "default_printer_name", + "type": "string", + "required": false, + "source": "body", + "description": "default_printer_name 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "print.hasName", + "description": "print.hasName 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "name", + "type": "string", + "required": true, + "source": "body", + "description": "name 参数" + }, + { + "name": "id", + "type": "number", + "required": false, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "print.updateItem", + "description": "print.updateItem 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + }, + { + "name": "computer_id", + "type": "number", + "required": false, + "source": "body", + "description": "computer_id 参数" + }, + { + "name": "custom_barcode", + "type": "string", + "required": false, + "source": "body", + "description": "custom_barcode 参数" + }, + { + "name": "name", + "type": "string", + "required": false, + "source": "body", + "description": "name 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "print.del", + "description": "print.del 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "ids", + "type": "array", + "required": false, + "source": "body", + "description": "ids 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "print.getComputer", + "description": "print.getComputer 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "print.getComputerPrinter", + "description": "print.getComputerPrinter 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "print.savePrinters", + "description": "print.savePrinters 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "defaultPrinter", + "type": "string", + "required": true, + "source": "body", + "description": "defaultPrinter 参数" + }, + { + "name": "express", + "type": "array", + "required": false, + "source": "body", + "description": "express 参数" + }, + { + "name": "print_station_id", + "type": "number", + "required": false, + "source": "body", + "description": "print_station_id 参数" + } + ], + "response": [], + "errors": [] + } + ] + }, + { + "groupName": "打印机站点模块", + "module": "printer.station", + "list": [ + { + "method": "printer.station.list", + "description": "获取打印站点列表", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + } + ] + }, + { + "groupName": "打印模板模块", + "module": "setting.printTemplate", + "list": [ + { + "method": "setting.printTemplate.list", + "description": "获取打印模板树", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "setting.printTemplate.save", + "description": "保存打印模板", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "setting.printTemplate.listTemplatesByType", + "description": "按业务类型查询模板", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "businessType", + "type": "string", + "required": true, + "source": "body", + "description": "businessType 参数" + } + ], + "response": [], + "errors": [] + } + ] + }, + { + "groupName": "库存模块", + "module": "stock", + "list": [ + { + "method": "stock.stockWarehouse", + "description": "stock.stockWarehouse 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "pagination", + "type": "object", + "required": false, + "source": "body", + "description": "pagination 参数" + }, + { + "name": "where", + "type": "object", + "required": false, + "source": "body", + "description": "where 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "stock.getProhibitedType", + "description": "stock.getProhibitedType 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.getInfo", + "description": "stock.getInfo 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.saveWarehouseStock", + "description": "stock.saveWarehouseStock 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.createWarehouseStock", + "description": "stock.createWarehouseStock 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.getBarcodes", + "description": "stock.getBarcodes 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.saveWarehouseStockBarcode", + "description": "stock.saveWarehouseStockBarcode 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.getStoreStocks", + "description": "stock.getStoreStocks 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.bindItem", + "description": "stock.bindItem 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.unbindItem", + "description": "stock.unbindItem 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.checkItemCodeUnique", + "description": "stock.checkItemCodeUnique 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "item_code", + "type": "string", + "required": true, + "source": "body", + "description": "item_code 参数" + }, + { + "name": "store_id", + "type": "number", + "required": true, + "source": "body", + "description": "store_id 参数" + }, + { + "name": "id", + "type": "number", + "required": false, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "stock.queryStockLogs", + "description": "stock.queryStockLogs 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "warehouseId", + "type": "string", + "required": false, + "source": "body", + "description": "warehouseId 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "stock.handleBatchDelete", + "description": "stock.handleBatchDelete 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.deleteUnit", + "description": "stock.deleteUnit 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.deleteProhibited", + "description": "stock.deleteProhibited 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.handleBatchChange", + "description": "stock.handleBatchChange 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.getStockUnits", + "description": "stock.getStockUnits 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.getUnitList", + "description": "stock.getUnitList 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.createProhibited", + "description": "stock.createProhibited 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "name", + "type": "string", + "required": true, + "source": "body", + "description": "name 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "stock.createUnit", + "description": "stock.createUnit 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "name", + "type": "string", + "required": true, + "source": "body", + "description": "name 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "stock.search", + "description": "stock.search 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + } + ] + }, + { + "groupName": "入库模块", + "module": "storage.receiving", + "list": [ + { + "method": "storage.receiving.getReceivingList", + "description": "storage.receiving.getReceivingList 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "pagination", + "type": "object", + "required": false, + "source": "body", + "description": "pagination 参数" + }, + { + "name": "where", + "type": "object", + "required": false, + "source": "body", + "description": "where 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "storage.receiving.getReceivingDetail", + "description": "storage.receiving.getReceivingDetail 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "storage.receiving.batchCancelReceiving", + "description": "storage.receiving.batchCancelReceiving 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "storage.receiving.create", + "description": "storage.receiving.create 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "storage.receiving.addItem", + "description": "storage.receiving.addItem 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": false, + "source": "body", + "description": "id 参数" + }, + { + "name": "item", + "type": "object", + "required": false, + "source": "body", + "description": "item 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "storage.receiving.removeItem", + "description": "storage.receiving.removeItem 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": false, + "source": "body", + "description": "id 参数" + }, + { + "name": "item_id", + "type": "number", + "required": false, + "source": "body", + "description": "item_id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "storage.receiving.saveReceiving", + "description": "storage.receiving.saveReceiving 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "storage.receiving.get", + "description": "storage.receiving.get 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "storage.receiving.addDetail", + "description": "storage.receiving.addDetail 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "storage.receiving.deleteDetail", + "description": "storage.receiving.deleteDetail 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "storage.receiving.detailChange", + "description": "storage.receiving.detailChange 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "storage.receiving.cancel", + "description": "storage.receiving.cancel 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "storage.receiving.completeReceiving", + "description": "storage.receiving.completeReceiving 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + } + ] + }, + { + "groupName": "门店模块", + "module": "store", + "list": [ + { + "method": "store.createStore", + "description": "store.createStore 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "store.createWarehouse", + "description": "store.createWarehouse 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "store.joinStore", + "description": "store.joinStore 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "store.joinWarehouse", + "description": "store.joinWarehouse 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "store.getStoreRoles", + "description": "store.getStoreRoles 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "store.auditApply", + "description": "store.auditApply 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + } + ] + }, + { + "groupName": "用户模块", + "module": "user", + "list": [ + { + "method": "user.login", + "description": "用户登录", + "isNeedAuth": false, + "isNeedLogin": false, + "headers": [], + "params": [ + { + "name": "password", + "type": "string", + "required": false, + "source": "body", + "description": "password 参数" + }, + { + "name": "username", + "type": "string", + "required": false, + "source": "body", + "description": "username 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "user.logout", + "description": "用户登出", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "user.info", + "description": "获取当前用户信息", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "user.changeRole", + "description": "user.changeRole 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "user.register", + "description": "user.register 接口", + "isNeedAuth": false, + "isNeedLogin": false, + "headers": [], + "params": [], + "response": [], + "errors": [] + } + ] + }, + { + "groupName": "仓库模块", + "module": "warehouse", + "list": [ + { + "method": "warehouse.getWarehouseZones", + "description": "warehouse.getWarehouseZones 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "warehouse.getWarehouseTree", + "description": "warehouse.getWarehouseTree 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "warehouseId", + "type": "number", + "required": true, + "source": "body", + "description": "warehouseId 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.getChildren", + "description": "warehouse.getChildren 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "zoneId", + "type": "number", + "required": true, + "source": "body", + "description": "zoneId 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.create", + "description": "warehouse.create 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "warehouse.update", + "description": "warehouse.update 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + }, + { + "name": "aisles", + "type": "string", + "required": false, + "source": "body", + "description": "aisles 参数" + }, + { + "name": "cell_height", + "type": "string", + "required": false, + "source": "body", + "description": "cell_height 参数" + }, + { + "name": "cell_length", + "type": "string", + "required": false, + "source": "body", + "description": "cell_length 参数" + }, + { + "name": "cell_width", + "type": "string", + "required": false, + "source": "body", + "description": "cell_width 参数" + }, + { + "name": "direction", + "type": "string", + "required": false, + "source": "body", + "description": "direction 参数" + }, + { + "name": "height", + "type": "number", + "required": false, + "source": "body", + "description": "height 参数" + }, + { + "name": "length", + "type": "number", + "required": false, + "source": "body", + "description": "length 参数" + }, + { + "name": "rack_columns", + "type": "string", + "required": false, + "source": "body", + "description": "rack_columns 参数" + }, + { + "name": "rack_levels", + "type": "string", + "required": false, + "source": "body", + "description": "rack_levels 参数" + }, + { + "name": "rack_rows", + "type": "string", + "required": false, + "source": "body", + "description": "rack_rows 参数" + }, + { + "name": "width", + "type": "number", + "required": false, + "source": "body", + "description": "width 参数" + }, + { + "name": "x", + "type": "number", + "required": false, + "source": "body", + "description": "x 参数" + }, + { + "name": "y", + "type": "number", + "required": false, + "source": "body", + "description": "y 参数" + }, + { + "name": "z", + "type": "number", + "required": false, + "source": "body", + "description": "z 参数" + }, + { + "name": "zone_code", + "type": "string", + "required": false, + "source": "body", + "description": "zone_code 参数" + }, + { + "name": "zone_name", + "type": "string", + "required": false, + "source": "body", + "description": "zone_name 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.delete", + "description": "warehouse.delete 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.detail", + "description": "warehouse.detail 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.checkBarcodeUnique", + "description": "warehouse.checkBarcodeUnique 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "barcode", + "type": "string", + "required": true, + "source": "body", + "description": "barcode 参数" + }, + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.toggleActive", + "description": "warehouse.toggleActive 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + }, + { + "name": "isActive", + "type": "string", + "required": false, + "source": "body", + "description": "isActive 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.getPath", + "description": "warehouse.getPath 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.createRack", + "description": "warehouse.createRack 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "height", + "type": "number", + "required": true, + "source": "body", + "description": "height 参数" + }, + { + "name": "length", + "type": "number", + "required": true, + "source": "body", + "description": "length 参数" + }, + { + "name": "rack_columns", + "type": "number", + "required": true, + "source": "body", + "description": "rack_columns 参数" + }, + { + "name": "rack_levels", + "type": "number", + "required": true, + "source": "body", + "description": "rack_levels 参数" + }, + { + "name": "rack_rows", + "type": "number", + "required": true, + "source": "body", + "description": "rack_rows 参数" + }, + { + "name": "warehouse_id", + "type": "number", + "required": true, + "source": "body", + "description": "warehouse_id 参数" + }, + { + "name": "width", + "type": "number", + "required": true, + "source": "body", + "description": "width 参数" + }, + { + "name": "x", + "type": "number", + "required": true, + "source": "body", + "description": "x 参数" + }, + { + "name": "y", + "type": "number", + "required": true, + "source": "body", + "description": "y 参数" + }, + { + "name": "zone_code", + "type": "string", + "required": true, + "source": "body", + "description": "zone_code 参数" + }, + { + "name": "zone_name", + "type": "string", + "required": true, + "source": "body", + "description": "zone_name 参数" + }, + { + "name": "color", + "type": "string", + "required": false, + "source": "body", + "description": "color 参数" + }, + { + "name": "direction", + "type": "string", + "required": false, + "source": "body", + "description": "direction 参数" + }, + { + "name": "parent_id", + "type": "number", + "required": false, + "source": "body", + "description": "parent_id 参数" + }, + { + "name": "z", + "type": "number", + "required": false, + "source": "body", + "description": "z 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.getPickPath", + "description": "warehouse.getPickPath 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "warehouse_id", + "type": "number", + "required": true, + "source": "query", + "description": "warehouse_id 参数" + }, + { + "name": "include_spaces", + "type": "string", + "required": false, + "source": "query", + "description": "include_spaces 参数" + }, + { + "name": "limit", + "type": "number", + "required": false, + "source": "query", + "description": "limit 参数" + }, + { + "name": "sort_by", + "type": "string", + "required": false, + "source": "query", + "description": "sort_by 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.updateRackPosition", + "description": "warehouse.updateRackPosition 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "x", + "type": "number", + "required": true, + "source": "body", + "description": "x 参数" + }, + { + "name": "y", + "type": "number", + "required": true, + "source": "body", + "description": "y 参数" + }, + { + "name": "rack_id", + "type": "number", + "required": false, + "source": "path", + "description": "rack_id 参数" + }, + { + "name": "z", + "type": "number", + "required": false, + "source": "body", + "description": "z 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.recalculatePickPath", + "description": "warehouse.recalculatePickPath 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "warehouse_id", + "type": "number", + "required": true, + "source": "body", + "description": "warehouse_id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.updateNeighbors", + "description": "warehouse.updateNeighbors 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "warehouse_id", + "type": "number", + "required": true, + "source": "body", + "description": "warehouse_id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.getAreaRacks", + "description": "warehouse.getAreaRacks 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "area_id", + "type": "number", + "required": true, + "source": "query", + "description": "area_id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.getSpacesByRack", + "description": "warehouse.getSpacesByRack 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.createRackWithSpaces", + "description": "warehouse.createRackWithSpaces 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.getSpaceInfo", + "description": "warehouse.getSpaceInfo 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": false, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.updateSpaceInfo", + "description": "warehouse.updateSpaceInfo 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + }, + { + "name": "custom_barcode", + "type": "string", + "required": false, + "source": "body", + "description": "custom_barcode 参数" + }, + { + "name": "custom_name", + "type": "string", + "required": false, + "source": "body", + "description": "custom_name 参数" + }, + { + "name": "location_type_id", + "type": "number", + "required": false, + "source": "body", + "description": "location_type_id 参数" + }, + { + "name": "pick_sequence", + "type": "string", + "required": false, + "source": "body", + "description": "pick_sequence 参数" + }, + { + "name": "space_status", + "type": "string", + "required": false, + "source": "body", + "description": "space_status 参数" + } + ], + "response": [], + "errors": [] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/script/db-query.ps1 b/script/db-query.ps1 new file mode 100644 index 0000000..10b9dce --- /dev/null +++ b/script/db-query.ps1 @@ -0,0 +1,104 @@ +param( + [Parameter(Mandatory = $true, Position = 0)] + [string]$Query, + + [Parameter(Mandatory = $false)] + [string]$DbClient = "wms", + + [Parameter(Mandatory = $false)] + [string]$ConfigPath = ".\\config\\config.local.js", + + [switch]$AsTable +) + + Set-StrictMode -Version Latest + $ErrorActionPreference = "Stop" + +$scriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Path +$projectRoot = Split-Path -Parent $scriptRoot +$configFullPath = Join-Path $projectRoot $ConfigPath +$configResolved = Resolve-Path -Path $configFullPath -ErrorAction Stop + +$nodeScript = @' +const path = require("path"); +const { createRequire } = require("module"); + +(async () => { + const projectRoot = process.argv[2]; + const configPath = process.argv[3]; + const clientName = process.argv[4]; + const query = process.argv[5]; + + const projectRequire = createRequire(path.join(projectRoot, "package.json")); + const mysql = projectRequire("mysql2/promise"); + + if (!query) { + throw new Error("Query is required."); + } + + const configFactory = require(path.resolve(configPath)); + const config = typeof configFactory === "function" + ? configFactory({ name: "wms-debug" }) + : configFactory; + + const client = config + && config.mysql + && config.mysql.clients + && config.mysql.clients[clientName]; + + if (!client) { + throw new Error(`MySQL client "${clientName}" not found in config.mysql.clients.`); + } + + const connection = await mysql.createConnection({ + host: client.host, + port: Number(client.port), + user: client.user, + password: client.password, + database: client.database, + charset: client.charset || "utf8mb4", + }); + + try { + const [rows] = await connection.query(query); + process.stdout.write(JSON.stringify({ + client: clientName, + rowCount: Array.isArray(rows) ? rows.length : 0, + rows, + })); + } finally { + await connection.end(); + } +})().catch((err) => { + process.stderr.write(err && err.stack ? err.stack : String(err)); + process.exit(1); +}); +'@ + +$tempFile = New-TemporaryFile +$tempNodeFile = [System.IO.Path]::ChangeExtension($tempFile.FullName, ".cjs") +Move-Item -Path $tempFile.FullName -Destination $tempNodeFile -Force +Set-Content -Path $tempNodeFile -Value $nodeScript -Encoding UTF8 + +try { + $json = & node $tempNodeFile $projectRoot $configResolved.Path $DbClient $Query + if ($LASTEXITCODE -ne 0) { + throw "Node query runner exited with code $LASTEXITCODE." + } +} finally { + Remove-Item -Path $tempNodeFile -ErrorAction SilentlyContinue +} + +$result = $json | ConvertFrom-Json +Write-Host "Client: $($result.client)" +Write-Host "Rows: $($result.rowCount)" + +if ($AsTable) { + if (($result.rows -is [System.Array]) -and $result.rows.Count -gt 0) { + $result.rows | Format-Table -AutoSize + } else { + Write-Host "No tabular rows to render." + } +} else { + $result | ConvertTo-Json -Depth 50 +} diff --git a/script/tmp-compare-order-schema.cjs b/script/tmp-compare-order-schema.cjs new file mode 100644 index 0000000..9bba2f3 --- /dev/null +++ b/script/tmp-compare-order-schema.cjs @@ -0,0 +1,171 @@ +const fs = require('fs'); +const path = require('path'); +const { createRequire } = require('module'); + +function extractTopLevelFieldsFromObjectBody(body) { + const fields = []; + let i = 0; + let depth = 0; + while (i < body.length) { + const ch = body[i]; + if (ch === '{') { + depth++; + i++; + continue; + } + if (ch === '}') { + depth--; + i++; + continue; + } + + if (depth === 0) { + const m = body.slice(i).match(/^\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*:\s*\{/); + if (m) { + const key = m[1]; + fields.push(key); + i += m[0].length; + let inner = 1; + while (i < body.length && inner > 0) { + const c = body[i++]; + if (c === '{') inner++; + if (c === '}') inner--; + } + continue; + } + } + i++; + } + return [...new Set(fields)]; +} + +function getObjectBodyByMarker(text, marker) { + const start = text.indexOf(marker); + if (start < 0) return null; + const braceStart = text.indexOf('{', start + marker.length); + if (braceStart < 0) return null; + let i = braceStart + 1; + let depth = 1; + let body = ''; + while (i < text.length && depth > 0) { + const ch = text[i++]; + if (ch === '{') depth++; + if (ch === '}') depth--; + if (depth > 0) body += ch; + } + return body; +} + +function extractDefineFields(text) { + const definePos = text.indexOf('define('); + if (definePos < 0) return []; + const firstBrace = text.indexOf('{', definePos); + if (firstBrace < 0) return []; + let i = firstBrace + 1; + let depth = 1; + let body = ''; + while (i < text.length && depth > 0) { + const ch = text[i++]; + if (ch === '{') depth++; + if (ch === '}') depth--; + if (depth > 0) body += ch; + } + return extractTopLevelFieldsFromObjectBody(body); +} + +async function main() { + const root = process.cwd(); + const projectRequire = createRequire(path.join(root, 'package.json')); + const mysql = projectRequire('mysql2/promise'); + const cfgFactory = require(path.join(root, 'config', 'config.local.js')); + const cfg = typeof cfgFactory === 'function' ? cfgFactory({ name: 'wms-debug' }) : cfgFactory; + const client = cfg?.mysql?.clients?.wms; + if (!client) throw new Error('mysql client wms not found'); + + const conn = await mysql.createConnection({ + host: client.host, + port: Number(client.port), + user: client.user, + password: client.password, + database: client.database, + charset: client.charset || 'utf8mb4', + }); + + const [tableRows] = await conn.query( + "SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() AND (TABLE_NAME IN ('wms_order_delivery','wms_order_items','wms_entry_order') OR TABLE_NAME LIKE 'wms_order_delivery_%' OR TABLE_NAME LIKE 'wms_order_items_%') ORDER BY TABLE_NAME" + ); + + const tableSchemas = {}; + for (const t of tableRows.map(x => x.TABLE_NAME)) { + const [cols] = await conn.query( + "SELECT COLUMN_NAME,COLUMN_TYPE,IS_NULLABLE,COLUMN_DEFAULT,EXTRA,COLUMN_KEY FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = ? ORDER BY ORDINAL_POSITION", + [t] + ); + tableSchemas[t] = cols; + } + + const targets = [ + { table: 'wms_order_delivery', modelFile: 'app/model/order_delivery.js', type: 'baseModel' }, + { table: 'wms_order_items', modelFile: 'app/model/order_items.js', type: 'define' }, + { table: 'wms_entry_order', modelFile: 'app/model/entry_order.js', type: 'define' }, + ]; + + const compareWithModel = targets.map(t => { + const txt = fs.readFileSync(path.join(root, t.modelFile), 'utf8'); + let modelFields = []; + if (t.type === 'baseModel') { + const body = getObjectBodyByMarker(txt, 'const baseModel ='); + modelFields = body ? extractTopLevelFieldsFromObjectBody(body) : []; + } else { + modelFields = extractDefineFields(txt); + } + + const dbColumns = (tableSchemas[t.table] || []).map(c => c.COLUMN_NAME); + const modelOnly = modelFields.filter(f => !dbColumns.includes(f)); + const dbOnly = dbColumns.filter(c => !modelFields.includes(c)); + + return { + table: t.table, + modelFile: t.modelFile, + modelFieldCount: modelFields.length, + dbFieldCount: dbColumns.length, + modelOnly, + dbOnly, + allMatched: modelOnly.length === 0 && dbOnly.length === 0, + }; + }); + + const dynamicTableCheck = []; + const dynamicTables = Object.keys(tableSchemas).filter(t => t.endsWith('_100000')); + for (const dt of dynamicTables) { + const baseTable = dt.startsWith('wms_order_delivery_') ? 'wms_order_delivery' : dt.startsWith('wms_order_items_') ? 'wms_order_items' : null; + if (!baseTable) continue; + const baseCols = (tableSchemas[baseTable] || []).map(c => c.COLUMN_NAME); + const dynCols = (tableSchemas[dt] || []).map(c => c.COLUMN_NAME); + dynamicTableCheck.push({ + table: dt, + baseTable, + missingFromDynamic: baseCols.filter(c => !dynCols.includes(c)), + extraInDynamic: dynCols.filter(c => !baseCols.includes(c)), + allMatched: baseCols.length === dynCols.length && baseCols.every(c => dynCols.includes(c)), + }); + } + + const out = { + generatedAt: new Date().toISOString(), + dbName: client.database, + tables: tableRows.map(x => x.TABLE_NAME), + compareWithModel, + dynamicTableCheck, + schema: tableSchemas, + }; + + fs.writeFileSync(path.join(root, 'tmp-order-schema-compare.json'), JSON.stringify(out, null, 2)); + await conn.end(); + console.log('WROTE tmp-order-schema-compare.json'); +} + +main().catch(err => { + console.error(err && err.stack ? err.stack : String(err)); + process.exit(1); +}); diff --git a/script/tmp-gen-service-method-inventory.cjs b/script/tmp-gen-service-method-inventory.cjs new file mode 100644 index 0000000..cf3f692 --- /dev/null +++ b/script/tmp-gen-service-method-inventory.cjs @@ -0,0 +1,97 @@ +const fs = require('fs'); +const path = require('path'); + +const root = process.cwd(); +const serviceRoot = path.join(root, 'app', 'service'); + +function walk(dir) { + const out = []; + for (const name of fs.readdirSync(dir)) { + const full = path.join(dir, name); + const st = fs.statSync(full); + if (st.isDirectory()) out.push(...walk(full)); + else if (name.endsWith('.js')) out.push(full); + } + return out; +} + +function extractClassMethods(content) { + const methods = []; + const classIdx = content.indexOf('class '); + if (classIdx < 0) return methods; + const braceStart = content.indexOf('{', classIdx); + if (braceStart < 0) return methods; + + let i = braceStart + 1; + let depth = 1; + let body = ''; + while (i < content.length && depth > 0) { + const ch = content[i++]; + if (ch === '{') depth++; + if (ch === '}') depth--; + if (depth > 0) body += ch; + } + + let p = 0; + let nested = 0; + while (p < body.length) { + const ch = body[p]; + if (ch === '{') { nested++; p++; continue; } + if (ch === '}') { nested--; p++; continue; } + + if (nested === 0) { + const slice = body.slice(p); + const m = slice.match(/^\s*(?:async\s+)?([A-Za-z_$][\w$]*)\s*\(/); + if (m) { + const name = m[1]; + if (name !== 'constructor') methods.push(name); + + // move to method body end + p += m[0].length; + while (p < body.length && body[p] !== '{') p++; + if (body[p] === '{') { + p++; + let inMethod = 1; + while (p < body.length && inMethod > 0) { + if (body[p] === '{') inMethod++; + else if (body[p] === '}') inMethod--; + p++; + } + } + continue; + } + } + p++; + } + + return [...new Set(methods)]; +} + +const files = walk(serviceRoot) + .map(full => path.relative(root, full).replace(/\\/g, '/')) + .sort((a, b) => a.localeCompare(b)); + +const inventory = []; +for (const rel of files) { + const full = path.join(root, rel); + const content = fs.readFileSync(full, 'utf8'); + const methods = extractClassMethods(content); + inventory.push({ file: rel, methodCount: methods.length, methods }); +} + +const now = new Date().toISOString(); +let md = ''; +md += `自动生成时间: ${now}\n\n`; +md += `扫描范围: app/service/**/*.js\n`; +md += `文件数: ${inventory.length}\n\n`; +for (const item of inventory) { + md += `- ${item.file} (${item.methodCount})\n`; + if (item.methods.length === 0) { + md += ` - \n`; + } else { + md += ` - ${item.methods.join(', ')}\n`; + } +} + +fs.writeFileSync(path.join(root, 'tmp-service-method-inventory.md'), md, 'utf8'); +console.log('WROTE tmp-service-method-inventory.md'); diff --git a/script/tmp-struct-system-params.cjs b/script/tmp-struct-system-params.cjs new file mode 100644 index 0000000..5d89be3 --- /dev/null +++ b/script/tmp-struct-system-params.cjs @@ -0,0 +1,421 @@ +const fs = require('fs'); +const path = require('path'); +const acorn = require('acorn'); + +const baseDir = process.cwd(); +const methodsDir = path.join(baseDir, 'app', 'service', 'systemMethods'); +const jsonPath = path.join(baseDir, 'methods', 'system.json'); + +function walk(node, visitor, parent = null) { + if (!node || typeof node !== 'object') return; + visitor(node, parent); + for (const key of Object.keys(node)) { + const value = node[key]; + if (!value) continue; + if (Array.isArray(value)) { + for (const item of value) walk(item, visitor, node); + } else if (typeof value === 'object' && value.type) { + walk(value, visitor, node); + } + } +} + +function walkFiles(dir) { + const files = []; + for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { + const full = path.join(dir, entry.name); + if (entry.isDirectory()) files.push(...walkFiles(full)); + if (entry.isFile() && entry.name.endsWith('.js')) files.push(full); + } + return files; +} + +function getPropName(node) { + if (!node) return null; + if (node.type === 'Identifier') return node.name; + if (node.type === 'Literal') return String(node.value); + return null; +} + +function memberPath(node) { + if (!node) return null; + if (node.type === 'ChainExpression') return memberPath(node.expression); + if (node.type === 'Identifier') return node.name; + if (node.type === 'ThisExpression') return 'this'; + if (node.type !== 'MemberExpression') return null; + const left = memberPath(node.object); + if (!left) return null; + if (node.computed) { + if (node.property.type === 'Literal') return `${left}.${String(node.property.value)}`; + if (node.property.type === 'Identifier') return left; + return left; + } + const right = getPropName(node.property); + return right ? `${left}.${right}` : left; +} + +function classifySourceByExpr(expr, signatureSet) { + const sources = new Set(); + const visit = node => { + if (!node) return; + if (node.type === 'Identifier' && signatureSet.has(node.name)) { + sources.add('body'); + return; + } + if (node.type === 'MemberExpression' || node.type === 'ChainExpression') { + const p = memberPath(node); + if (p && p.startsWith('ctx.request.body')) sources.add('body'); + else if (p && p.startsWith('ctx.query')) sources.add('query'); + else if (p && p.startsWith('ctx.params')) sources.add('path'); + else if (p && p.startsWith('ctx.headers')) sources.add('header'); + return; + } + if (node.type === 'LogicalExpression' || node.type === 'BinaryExpression') { + visit(node.left); + visit(node.right); + return; + } + if (node.type === 'ConditionalExpression') { + visit(node.consequent); + visit(node.alternate); + return; + } + }; + visit(expr); + if (!sources.size) return null; + return Array.from(sources).sort().join('|'); +} + +function inferTypeByName(name) { + if (!name) return 'string'; + if (/ids$/i.test(name)) return 'array'; + if (/^(where|pagination|item|template|data|filters?)$/i.test(name)) return 'object'; + if (/^(is_|has_|need|sync)/i.test(name)) return 'boolean'; + if (/(^id$|_id$|^page$|^pageSize$|^limit$|^offset$|^count$|_count$|^x$|^y$|^z$|^rows$|^columns$|^levels$|^width$|^height$|^length$)/i.test(name)) return 'number'; + if (/(^date$|_date$|^time$|_time$|timestamp)/i.test(name)) return 'string'; + return 'string'; +} + +function inferTypeByNode(node, fallbackName = '') { + if (!node) return inferTypeByName(fallbackName); + if (node.type === 'Literal') { + if (typeof node.value === 'number') return 'number'; + if (typeof node.value === 'boolean') return 'boolean'; + return 'string'; + } + if (node.type === 'ObjectExpression') return 'object'; + if (node.type === 'ArrayExpression') return 'array'; + return inferTypeByName(fallbackName); +} + +function mapValidateType(v) { + if (!v) return 'string'; + const t = String(v).toLowerCase(); + if (t === 'int' || t === 'integer' || t === 'number') return 'number'; + if (t === 'boolean' || t === 'bool') return 'boolean'; + if (t === 'array') return 'array'; + if (t === 'object') return 'object'; + return 'string'; +} + +function extractNoNeedLists(classNode) { + const result = { noNeedLogin: [], noNeedAuth: ['*'] }; + const ctor = classNode.body.body.find(m => m.type === 'MethodDefinition' && m.kind === 'constructor'); + if (!ctor) return result; + + for (const stmt of ctor.value.body.body || []) { + if (stmt.type !== 'VariableDeclaration') continue; + for (const decl of stmt.declarations || []) { + if (decl.id.type !== 'Identifier' || !decl.init || decl.init.type !== 'Literal') continue; + const name = decl.id.name; + const value = String(decl.init.value || ''); + if (name === '_noNeedLogin') result.noNeedLogin = value.split(',').map(s => s.trim()).filter(Boolean); + if (name === '_noNeedAuth') result.noNeedAuth = value.split(',').map(s => s.trim()).filter(Boolean); + } + } + return result; +} + +function collectMethodParams(methodNode) { + const signatureNames = []; + for (const p of methodNode.value.params || []) { + if (p.type === 'Identifier') signatureNames.push(p.name); + else if (p.type === 'AssignmentPattern' && p.left.type === 'Identifier') signatureNames.push(p.left.name); + } + const signatureSet = new Set(signatureNames); + const aliasMap = new Map(); + const entries = new Map(); + const listFields = []; + + function resolveName(localName) { + return aliasMap.get(localName) || localName; + } + + function ensure(name) { + if (!entries.has(name)) { + entries.set(name, { + name, + type: inferTypeByName(name), + required: false, + source: new Set(), + }); + } + return entries.get(name); + } + + function addParam(name, patch = {}) { + if (!name) return; + if ([ 'ctx', 'service', 'app', 'result', 'error', 'e' ].includes(name)) return; + const item = ensure(name); + if (patch.type) item.type = patch.type; + if (patch.required === true) item.required = true; + if (patch.source) item.source.add(patch.source); + } + + function addRequiredFromTest(testNode) { + if (!testNode) return; + if (testNode.type === 'UnaryExpression' && testNode.operator === '!') { + if (testNode.argument.type === 'Identifier') { + const local = testNode.argument.name; + const resolved = resolveName(local); + if (resolved !== local || entries.has(resolved)) { + addParam(resolved, { required: true }); + } + } + if (testNode.argument.type === 'MemberExpression' || testNode.argument.type === 'ChainExpression') { + const p = memberPath(testNode.argument); + if (!p) return; + const parts = p.split('.'); + if (parts.length === 2 && signatureSet.has(parts[0])) { + addParam(parts[1], { required: true, source: 'body' }); + } + } + return; + } + if (testNode.type === 'LogicalExpression') { + addRequiredFromTest(testNode.left); + addRequiredFromTest(testNode.right); + return; + } + if (testNode.type === 'CallExpression') { + const callee = memberPath(testNode.callee); + if (callee === 'Array.isArray' && testNode.arguments[0] && testNode.arguments[0].type === 'Identifier') { + const local = testNode.arguments[0].name; + const resolved = resolveName(local); + if (resolved !== local || entries.has(resolved)) { + addParam(resolved, { required: true, type: 'array' }); + } + } + } + } + + walk(methodNode.value.body, (node, parent) => { + if (node.type === 'VariableDeclarator') { + if (node.id.type === 'ObjectPattern' && node.init) { + const source = classifySourceByExpr(node.init, signatureSet); + if (!source) return; + for (const prop of node.id.properties || []) { + if (prop.type !== 'Property') continue; + const keyName = getPropName(prop.key); + if (!keyName) continue; + + let localName = keyName; + let type = inferTypeByName(keyName); + + if (prop.value.type === 'Identifier') { + localName = prop.value.name; + } else if (prop.value.type === 'AssignmentPattern') { + if (prop.value.left.type === 'Identifier') localName = prop.value.left.name; + type = inferTypeByNode(prop.value.right, keyName); + } + + aliasMap.set(localName, keyName); + addParam(keyName, { source, type }); + } + } + + if (node.id.type === 'Identifier' && node.init) { + const local = node.id.name; + + if (node.init.type === 'MemberExpression' || node.init.type === 'ChainExpression') { + const p = memberPath(node.init); + if (p) { + const parts = p.split('.'); + if (parts.length === 2 && signatureSet.has(parts[0])) { + aliasMap.set(local, parts[1]); + addParam(parts[1], { source: 'body' }); + } + if (parts.length >= 3 && parts[0] === 'ctx' && parts[1] === 'query') { + aliasMap.set(local, parts[2]); + addParam(parts[2], { source: 'query' }); + } + if (parts.length >= 3 && parts[0] === 'ctx' && parts[1] === 'params') { + aliasMap.set(local, parts[2]); + addParam(parts[2], { source: 'path' }); + } + if (parts.length >= 4 && parts[0] === 'ctx' && parts[1] === 'request' && parts[2] === 'body') { + aliasMap.set(local, parts[3]); + addParam(parts[3], { source: 'body' }); + } + } + } + + if ((/allowedFields|eqFields/i).test(local) && node.init.type === 'ArrayExpression') { + const arr = []; + for (const el of node.init.elements || []) { + if (el && el.type === 'Literal' && typeof el.value === 'string') arr.push(el.value); + } + if (arr.length) listFields.push(...arr); + } + } + } + + if (node.type === 'IfStatement') { + addRequiredFromTest(node.test); + } + + if (node.type === 'CallExpression') { + const callee = memberPath(node.callee); + + if (callee === 'ctx.validate' && node.arguments[0] && node.arguments[0].type === 'ObjectExpression') { + for (const p of node.arguments[0].properties || []) { + if (p.type !== 'Property') continue; + const field = getPropName(p.key); + if (!field || p.value.type !== 'ObjectExpression') continue; + let required = false; + let type = null; + for (const conf of p.value.properties || []) { + if (conf.type !== 'Property') continue; + const confKey = getPropName(conf.key); + if (!confKey) continue; + if (confKey === 'required' && conf.value.type === 'Literal') { + required = Boolean(conf.value.value); + } + if (confKey === 'type' && conf.value.type === 'Literal') { + type = mapValidateType(conf.value.value); + } + } + addParam(field, { required, type: type || inferTypeByName(field), source: 'body' }); + } + } + + if (callee === 'Array.isArray' && node.arguments[0] && node.arguments[0].type === 'Identifier') { + const local = node.arguments[0].name; + const resolved = resolveName(local); + if (resolved !== local || entries.has(resolved)) { + addParam(resolved, { type: 'array' }); + } + } + + if ((callee === 'parseInt' || callee === 'Number') && node.arguments[0]) { + const arg = node.arguments[0]; + if (arg.type === 'Identifier') { + const resolved = resolveName(arg.name); + if (resolved !== arg.name || entries.has(resolved)) { + addParam(resolved, { type: 'number' }); + } + } + if (arg.type === 'MemberExpression' || arg.type === 'ChainExpression') { + const p = memberPath(arg); + if (p) { + const parts = p.split('.'); + if (parts.length === 2 && signatureSet.has(parts[0])) addParam(parts[1], { type: 'number', source: 'body' }); + } + } + } + } + + if (node.type === 'MemberExpression' || node.type === 'ChainExpression') { + const p = memberPath(node); + if (!p) return; + const parts = p.split('.'); + if (parts.length === 2 && signatureSet.has(parts[0])) { + addParam(parts[1], { source: 'body' }); + } + if (parts.length >= 3 && parts[0] === 'ctx' && parts[1] === 'query') { + addParam(parts[2], { source: 'query' }); + } + if (parts.length >= 3 && parts[0] === 'ctx' && parts[1] === 'params') { + addParam(parts[2], { source: 'path' }); + } + if (parts.length >= 4 && parts[0] === 'ctx' && parts[1] === 'request' && parts[2] === 'body') { + addParam(parts[3], { source: 'body' }); + } + } + }); + + for (const f of listFields) { + addParam(f, { source: 'body' }); + } + + const result = Array.from(entries.values()).map(item => ({ + name: item.name, + type: item.type, + required: item.required, + source: item.source.size ? Array.from(item.source).sort().join('|') : 'body', + description: `${item.name} 参数`, + })); + + result.sort((a, b) => { + if (a.required !== b.required) return a.required ? -1 : 1; + return a.name.localeCompare(b.name); + }); + + return result; +} + +function buildMethodParamMap() { + const map = new Map(); + const files = walkFiles(methodsDir); + + for (const file of files) { + const source = fs.readFileSync(file, 'utf8'); + const ast = acorn.parse(source, { ecmaVersion: 'latest', sourceType: 'script' }); + const relative = path.relative(methodsDir, file).replace(/\\/g, '/').replace(/\.js$/, ''); + const moduleName = relative.replace(/\//g, '.'); + + for (const node of ast.body) { + if (node.type !== 'ClassDeclaration') continue; + const noNeed = extractNoNeedLists(node); + for (const method of node.body.body) { + if (method.type !== 'MethodDefinition') continue; + if (method.kind !== 'method') continue; + if (!method.value.async) continue; + const methodName = method.key && method.key.name; + if (!methodName) continue; + + const fullMethod = `${moduleName}.${methodName}`; + const params = collectMethodParams(method); + + for (const p of params) { + if (noNeed.noNeedLogin.includes('*') || noNeed.noNeedLogin.includes(methodName)) { + if (p.name.toLowerCase().includes('authorization') || p.source === 'header') p.required = false; + } + } + + map.set(fullMethod, params); + } + } + } + + return map; +} + +const methodParamMap = buildMethodParamMap(); +const doc = JSON.parse(fs.readFileSync(jsonPath, 'utf8')); + +let updated = 0; +for (const group of doc.methods.groups || []) { + for (const item of group.list || []) { + const next = methodParamMap.get(item.method) || []; + item.params = next; + updated++; + } +} + +doc.version = '0.3.0'; +doc.updatedAt = '2026-03-22'; + +fs.writeFileSync(jsonPath, JSON.stringify(doc, null, 2) + '\n', 'utf8'); +console.log(`updated methods: ${updated}`); +console.log(`mapped methods: ${methodParamMap.size}`); diff --git a/script/tmp-update-ai-method-routing.cjs b/script/tmp-update-ai-method-routing.cjs new file mode 100644 index 0000000..b05fc89 --- /dev/null +++ b/script/tmp-update-ai-method-routing.cjs @@ -0,0 +1,30 @@ +const fs = require('fs'); +const path = require('path'); + +const root = process.cwd(); +const target = path.join(root, 'AI_METHOD_ROUTING.md'); +const inventoryPath = path.join(root, 'tmp-service-method-inventory.md'); + +const base = fs.readFileSync(target, 'utf8'); +const inventory = fs.readFileSync(inventoryPath, 'utf8').trim(); + +const section = `\n\n## 6. 全量 Service Method 能力清单(自动扫描)\n\n维护说明:\n- 扫描范围:app/service/**/*.js\n- 本节内容由脚本生成,新增/修改 service 后请同步刷新。\n- 刷新命令:node .\\script\\tmp-gen-service-method-inventory.cjs\n\n\n${inventory}\n\n`; + +const begin = ''; +const end = ''; + +let next; +if (base.includes(begin) && base.includes(end)) { + const start = base.indexOf(begin); + const finish = base.indexOf(end) + end.length; + const head = base.slice(0, base.lastIndexOf('\n## 6. 全量 Service Method 能力清单(自动扫描)', start) >= 0 + ? base.lastIndexOf('\n## 6. 全量 Service Method 能力清单(自动扫描)', start) + : start); + const tail = base.slice(finish); + next = head.trimEnd() + section + tail; +} else { + next = base.trimEnd() + section; +} + +fs.writeFileSync(target, next + '\n', 'utf8'); +console.log('UPDATED AI_METHOD_ROUTING.md'); diff --git a/tmp-order-schema-compare.json b/tmp-order-schema-compare.json new file mode 100644 index 0000000..e3f3f41 --- /dev/null +++ b/tmp-order-schema-compare.json @@ -0,0 +1,1610 @@ +{ + "generatedAt": "2026-03-22T06:08:48.627Z", + "dbName": "wms", + "tables": [ + "wms_entry_order", + "wms_order_delivery", + "wms_order_delivery_100000", + "wms_order_items", + "wms_order_items_100000" + ], + "compareWithModel": [ + { + "table": "wms_order_delivery", + "modelFile": "app/model/order_delivery.js", + "modelFieldCount": 72, + "dbFieldCount": 54, + "modelOnly": [ + "from_key", + "items", + "items_count", + "items_total", + "items_weight", + "items_hash", + "items_crc", + "wave_id", + "post_status", + "storage_status", + "pick_status", + "pack_status", + "inspection_status", + "print_status", + "claim_status", + "outbound_status", + "lock_status", + "intercept_status" + ], + "dbOnly": [], + "allMatched": false + }, + { + "table": "wms_order_items", + "modelFile": "app/model/order_items.js", + "modelFieldCount": 18, + "dbFieldCount": 15, + "modelOnly": [ + "stock_id", + "created_at", + "updated_at" + ], + "dbOnly": [], + "allMatched": false + }, + { + "table": "wms_entry_order", + "modelFile": "app/model/entry_order.js", + "modelFieldCount": 28, + "dbFieldCount": 28, + "modelOnly": [], + "dbOnly": [], + "allMatched": true + } + ], + "dynamicTableCheck": [ + { + "table": "wms_order_delivery_100000", + "baseTable": "wms_order_delivery", + "missingFromDynamic": [], + "extraInDynamic": [ + "from_key", + "items", + "items_count", + "items_total", + "items_weight", + "items_hash", + "items_crc", + "wave_id", + "post_status", + "storage_status", + "pick_status", + "pack_status", + "inspection_status", + "print_status", + "claim_status", + "outbound_status", + "lock_status", + "intercept_status" + ], + "allMatched": false + }, + { + "table": "wms_order_items_100000", + "baseTable": "wms_order_items", + "missingFromDynamic": [], + "extraInDynamic": [ + "stock_id", + "created_at", + "updated_at" + ], + "allMatched": false + } + ], + "schema": { + "wms_entry_order": [ + { + "COLUMN_NAME": "id", + "COLUMN_TYPE": "bigint(20) unsigned", + "IS_NULLABLE": "NO", + "COLUMN_DEFAULT": null, + "EXTRA": "auto_increment", + "COLUMN_KEY": "PRI" + }, + { + "COLUMN_NAME": "entry_order_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "NO", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "order_type", + "COLUMN_TYPE": "enum('SCRK','LYRK','CCRK','CGRK','DBRK','QTRK','B2BRK','XNRK')", + "IS_NULLABLE": "NO", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "purchase_order_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "total_order_lines", + "COLUMN_TYPE": "int(11)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "0", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "order_create_time", + "COLUMN_TYPE": "datetime", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "expect_start_time", + "COLUMN_TYPE": "datetime", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "expect_end_time", + "COLUMN_TYPE": "datetime", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "logistics_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "logistics_name", + "COLUMN_TYPE": "varchar(200)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "express_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "supplier_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "supplier_name", + "COLUMN_TYPE": "varchar(200)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "source_type", + "COLUMN_TYPE": "enum('WMS','API','QM')", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "API", + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "order_status", + "COLUMN_TYPE": "enum('PENDING','CONFIRMED','PARTIAL_RECEIVED','COMPLETED','CANCELLED','CREATED','CREATING')", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "PENDING", + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "sync_status", + "COLUMN_TYPE": "enum('PENDING','SUCCESS','FAILED')", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "PENDING", + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "sync_message", + "COLUMN_TYPE": "text", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "is_enabled", + "COLUMN_TYPE": "tinyint(1)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "1", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "created_at", + "COLUMN_TYPE": "timestamp", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "CURRENT_TIMESTAMP", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "updated_at", + "COLUMN_TYPE": "timestamp", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "CURRENT_TIMESTAMP", + "EXTRA": "on update CURRENT_TIMESTAMP", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "warehouse_id", + "COLUMN_TYPE": "bigint(20) unsigned", + "IS_NULLABLE": "NO", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "store_id", + "COLUMN_TYPE": "bigint(20) unsigned", + "IS_NULLABLE": "NO", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "remark", + "COLUMN_TYPE": "varchar(500)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "store_name", + "COLUMN_TYPE": "varchar(200)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "warehouse_name", + "COLUMN_TYPE": "varchar(200)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "deleted_at", + "COLUMN_TYPE": "datetime", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "qimen_owner_code", + "COLUMN_TYPE": "varchar(100)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "qimen_warehouse_code", + "COLUMN_TYPE": "varchar(100)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + } + ], + "wms_order_delivery": [ + { + "COLUMN_NAME": "id", + "COLUMN_TYPE": "bigint(20) unsigned", + "IS_NULLABLE": "NO", + "COLUMN_DEFAULT": null, + "EXTRA": "auto_increment", + "COLUMN_KEY": "PRI" + }, + { + "COLUMN_NAME": "delivery_order_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "pre_delivery_order_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "pre_delivery_order_id", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "order_type", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "warehouse_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "order_flag", + "COLUMN_TYPE": "varchar(200)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "source_platform_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "source_platform_name", + "COLUMN_TYPE": "varchar(200)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "create_at", + "COLUMN_TYPE": "datetime", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "delete_at", + "COLUMN_TYPE": "datetime", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "updated_at", + "COLUMN_TYPE": "datetime", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "place_order_time", + "COLUMN_TYPE": "datetime", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "pay_time", + "COLUMN_TYPE": "datetime", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "pay_no", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "service_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "operator_name", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "operate_time", + "COLUMN_TYPE": "datetime", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "delivery_time", + "COLUMN_TYPE": "datetime", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "shop_nick", + "COLUMN_TYPE": "varchar(200)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "seller_nick", + "COLUMN_TYPE": "varchar(200)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "buyer_nick", + "COLUMN_TYPE": "varchar(200)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "total_amount", + "COLUMN_TYPE": "decimal(18,2)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "item_amount", + "COLUMN_TYPE": "decimal(18,2)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "discount_amount", + "COLUMN_TYPE": "decimal(18,2)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "freight", + "COLUMN_TYPE": "decimal(18,2)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "ar_amount", + "COLUMN_TYPE": "decimal(18,2)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "got_amount", + "COLUMN_TYPE": "decimal(18,2)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "service_fee", + "COLUMN_TYPE": "decimal(18,2)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "logistics_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "logistics_name", + "COLUMN_TYPE": "varchar(200)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "express_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "logistics_area_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "delivery_type", + "COLUMN_TYPE": "varchar(255)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "is_urgency", + "COLUMN_TYPE": "enum('Y','N')", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "N", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "invoice_flag", + "COLUMN_TYPE": "enum('Y','N')", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "N", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "status", + "COLUMN_TYPE": "enum('pedding','created','cancel','intercepting','intercepted')", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "pedding", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "name", + "COLUMN_TYPE": "text", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "zip_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "tel", + "COLUMN_TYPE": "text", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "mobile", + "COLUMN_TYPE": "text", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "email", + "COLUMN_TYPE": "text", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "country_code", + "COLUMN_TYPE": "varchar(255)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "province", + "COLUMN_TYPE": "varchar(255)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "city", + "COLUMN_TYPE": "varchar(255)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "area", + "COLUMN_TYPE": "varchar(255)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "town", + "COLUMN_TYPE": "varchar(255)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "detail_address", + "COLUMN_TYPE": "varchar(255)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "id_type", + "COLUMN_TYPE": "varchar(255)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "id_number", + "COLUMN_TYPE": "int(11)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "oaid", + "COLUMN_TYPE": "text", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "sync_status", + "COLUMN_TYPE": "enum('padding','fin','error')", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "padding", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "store_id", + "COLUMN_TYPE": "bigint(20) unsigned", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "warehouse_id", + "COLUMN_TYPE": "bigint(20) unsigned", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "MUL" + } + ], + "wms_order_delivery_100000": [ + { + "COLUMN_NAME": "id", + "COLUMN_TYPE": "bigint(20) unsigned", + "IS_NULLABLE": "NO", + "COLUMN_DEFAULT": null, + "EXTRA": "auto_increment", + "COLUMN_KEY": "PRI" + }, + { + "COLUMN_NAME": "delivery_order_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "pre_delivery_order_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "pre_delivery_order_id", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "order_type", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "warehouse_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "order_flag", + "COLUMN_TYPE": "varchar(200)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "source_platform_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "source_platform_name", + "COLUMN_TYPE": "varchar(200)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "create_at", + "COLUMN_TYPE": "datetime", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "delete_at", + "COLUMN_TYPE": "datetime", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "updated_at", + "COLUMN_TYPE": "datetime", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "place_order_time", + "COLUMN_TYPE": "datetime", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "pay_time", + "COLUMN_TYPE": "datetime", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "pay_no", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "service_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "operator_name", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "operate_time", + "COLUMN_TYPE": "datetime", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "delivery_time", + "COLUMN_TYPE": "datetime", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "shop_nick", + "COLUMN_TYPE": "varchar(200)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "seller_nick", + "COLUMN_TYPE": "varchar(200)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "buyer_nick", + "COLUMN_TYPE": "varchar(200)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "total_amount", + "COLUMN_TYPE": "decimal(18,2)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "item_amount", + "COLUMN_TYPE": "decimal(18,2)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "discount_amount", + "COLUMN_TYPE": "decimal(18,2)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "freight", + "COLUMN_TYPE": "decimal(18,2)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "ar_amount", + "COLUMN_TYPE": "decimal(18,2)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "got_amount", + "COLUMN_TYPE": "decimal(18,2)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "service_fee", + "COLUMN_TYPE": "decimal(18,2)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "logistics_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "logistics_name", + "COLUMN_TYPE": "varchar(200)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "express_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "logistics_area_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "delivery_type", + "COLUMN_TYPE": "varchar(255)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "is_urgency", + "COLUMN_TYPE": "enum('Y','N')", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "N", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "invoice_flag", + "COLUMN_TYPE": "enum('Y','N')", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "N", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "status", + "COLUMN_TYPE": "enum('pedding','created','cancel','error','after-sales-error')", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "created", + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "name", + "COLUMN_TYPE": "text", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "zip_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "tel", + "COLUMN_TYPE": "text", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "mobile", + "COLUMN_TYPE": "text", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "email", + "COLUMN_TYPE": "text", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "country_code", + "COLUMN_TYPE": "varchar(255)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "province", + "COLUMN_TYPE": "varchar(255)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "city", + "COLUMN_TYPE": "varchar(255)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "area", + "COLUMN_TYPE": "varchar(255)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "town", + "COLUMN_TYPE": "varchar(255)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "detail_address", + "COLUMN_TYPE": "varchar(255)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "id_type", + "COLUMN_TYPE": "varchar(255)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "id_number", + "COLUMN_TYPE": "int(11)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "oaid", + "COLUMN_TYPE": "text", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "sync_status", + "COLUMN_TYPE": "enum('padding','fin','error','none')", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "padding", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "store_id", + "COLUMN_TYPE": "bigint(20) unsigned", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "warehouse_id", + "COLUMN_TYPE": "bigint(20) unsigned", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "from_key", + "COLUMN_TYPE": "int(11)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "items", + "COLUMN_TYPE": "text", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "items_count", + "COLUMN_TYPE": "smallint(5) unsigned", + "IS_NULLABLE": "NO", + "COLUMN_DEFAULT": "0", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "items_total", + "COLUMN_TYPE": "int(10) unsigned", + "IS_NULLABLE": "NO", + "COLUMN_DEFAULT": "0", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "items_weight", + "COLUMN_TYPE": "decimal(10,2)", + "IS_NULLABLE": "NO", + "COLUMN_DEFAULT": "0.00", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "items_hash", + "COLUMN_TYPE": "char(32)", + "IS_NULLABLE": "NO", + "COLUMN_DEFAULT": "", + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "items_crc", + "COLUMN_TYPE": "int(10) unsigned", + "IS_NULLABLE": "NO", + "COLUMN_DEFAULT": "0", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "wave_id", + "COLUMN_TYPE": "bigint(20)", + "IS_NULLABLE": "NO", + "COLUMN_DEFAULT": "0", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "post_status", + "COLUMN_TYPE": "enum('padding','fin','timeout','error','none')", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "none", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "storage_status", + "COLUMN_TYPE": "enum('padding','fin','error','none')", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "none", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "pick_status", + "COLUMN_TYPE": "enum('padding','fin','error','none')", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "none", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "pack_status", + "COLUMN_TYPE": "enum('none','padding','fin','error')", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "none", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "inspection_status", + "COLUMN_TYPE": "enum('none','padding','running','fin','error')", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "none", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "print_status", + "COLUMN_TYPE": "enum('none','padding','fin','error')", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "none", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "claim_status", + "COLUMN_TYPE": "enum('none','padding','fin','error')", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "none", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "outbound_status", + "COLUMN_TYPE": "enum('none','padding','fin','error')", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "none", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "lock_status", + "COLUMN_TYPE": "enum('none','warehouse','store')", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "none", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "intercept_status", + "COLUMN_TYPE": "enum('none','requesting','requested','intercepting','intercepted_in_transit','intercepted_at_warehouse','returning','returned','delivered_by_mistake','timeout','cancelled','failed','exception')", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": "none", + "EXTRA": "", + "COLUMN_KEY": "" + } + ], + "wms_order_items": [ + { + "COLUMN_NAME": "id", + "COLUMN_TYPE": "bigint(20) unsigned", + "IS_NULLABLE": "NO", + "COLUMN_DEFAULT": null, + "EXTRA": "auto_increment", + "COLUMN_KEY": "PRI" + }, + { + "COLUMN_NAME": "order_id", + "COLUMN_TYPE": "bigint(20) unsigned", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "actual_price", + "COLUMN_TYPE": "decimal(18,2)", + "IS_NULLABLE": "NO", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "retail_price", + "COLUMN_TYPE": "decimal(18,2)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "ext_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "inventory_type", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "item_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "item_id", + "COLUMN_TYPE": "bigint(20) unsigned", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "item_name", + "COLUMN_TYPE": "varchar(200)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "order_line_no", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "owner_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "plan_qty", + "COLUMN_TYPE": "int(11)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "source_order_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "sub_source_order_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "extend_props", + "COLUMN_TYPE": "text", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + } + ], + "wms_order_items_100000": [ + { + "COLUMN_NAME": "id", + "COLUMN_TYPE": "bigint(20) unsigned", + "IS_NULLABLE": "NO", + "COLUMN_DEFAULT": null, + "EXTRA": "auto_increment", + "COLUMN_KEY": "PRI" + }, + { + "COLUMN_NAME": "order_id", + "COLUMN_TYPE": "bigint(20) unsigned", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "actual_price", + "COLUMN_TYPE": "decimal(18,2)", + "IS_NULLABLE": "NO", + "COLUMN_DEFAULT": "0.00", + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "retail_price", + "COLUMN_TYPE": "decimal(18,2)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "ext_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "inventory_type", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "item_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "item_id", + "COLUMN_TYPE": "bigint(20)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "item_name", + "COLUMN_TYPE": "varchar(200)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "order_line_no", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "owner_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "plan_qty", + "COLUMN_TYPE": "int(11)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "source_order_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "sub_source_order_code", + "COLUMN_TYPE": "varchar(50)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "extend_props", + "COLUMN_TYPE": "json", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "" + }, + { + "COLUMN_NAME": "stock_id", + "COLUMN_TYPE": "bigint(20)", + "IS_NULLABLE": "YES", + "COLUMN_DEFAULT": null, + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "created_at", + "COLUMN_TYPE": "datetime", + "IS_NULLABLE": "NO", + "COLUMN_DEFAULT": "CURRENT_TIMESTAMP", + "EXTRA": "", + "COLUMN_KEY": "MUL" + }, + { + "COLUMN_NAME": "updated_at", + "COLUMN_TYPE": "datetime", + "IS_NULLABLE": "NO", + "COLUMN_DEFAULT": "CURRENT_TIMESTAMP", + "EXTRA": "on update CURRENT_TIMESTAMP", + "COLUMN_KEY": "" + } + ] + } +} \ No newline at end of file diff --git a/tmp-order-schema-workflow.md b/tmp-order-schema-workflow.md new file mode 100644 index 0000000..16963db --- /dev/null +++ b/tmp-order-schema-workflow.md @@ -0,0 +1,81 @@ +# 订单表结构与 Model 比对临时工作流 + +更新时间: 2026-03-22 + +## 1. 目标 + +用于后续排查订单相关问题时,快速复用以下能力: +- 获取数据库订单表结构 +- 与当前 Model 做字段级比对 +- 识别主表/分仓动态表的结构漂移 + +## 2. 本次已确认的订单相关表 + +- wms_entry_order +- wms_order_delivery +- wms_order_delivery_100000 +- wms_order_items +- wms_order_items_100000 + +## 3. 相关 Model + +- app/model/entry_order.js +- app/model/order_delivery.js +- app/model/order_items.js +- app/model/order_delivery_factory.js +- app/model/order_items_factory.js + +## 4. 已生成产物 + +- 结构与差异总结果: tmp-order-schema-compare.json +- 比对脚本(可复跑): script/tmp-compare-order-schema.cjs + +## 5. 关键比对结论 + +### 5.1 wms_entry_order vs entry_order model +- 字段数: model 28 / db 28 +- 结论: 完全一致 + +### 5.2 wms_order_delivery vs order_delivery model +- 字段数: model 72 / db 54 +- model 有但主表 db 没有的字段: + from_key, items, items_count, items_total, items_weight, items_hash, items_crc, wave_id, + post_status, storage_status, pick_status, pack_status, inspection_status, print_status, + claim_status, outbound_status, lock_status, intercept_status +- 结论: 主表结构落后于模型定义 + +补充: +- delivery_time(发货时间) 已在主表与动态表补齐,并同步到 model 与动态建表 SQL。 + +### 5.3 wms_order_items vs order_items model +- 字段数: model 18 / db 15 +- model 有但主表 db 没有的字段: + stock_id, created_at, updated_at +- 结论: 主表结构落后于模型定义 + +### 5.4 动态表 vs 主表 +- wms_order_delivery_100000 相比 wms_order_delivery 多出 18 个字段(与 modelOnly 一致) +- wms_order_items_100000 相比 wms_order_items 多出 3 个字段(与 modelOnly 一致) +- 结论: 动态表更接近当前模型,主表较旧 + +## 6. 复用命令 + +### 6.1 一键重跑比对 +PowerShell: + +node .\script\tmp-compare-order-schema.cjs + +### 6.2 快速查看结果摘要 +PowerShell: + +Get-Content .\tmp-order-schema-compare.json -TotalCount 160 + +## 7. 后续建议 + +1. 若以主表为准,需回退 model 字段定义到主表现状,避免 ORM 读写异常。 +2. 若以模型为准,补充 migration,将主表补齐到动态表同等结构。 +3. 在服务中明确当前读写表策略(主表或动态表),避免混用导致字段可用性不一致。 + +## 8. 备注 + +本文件为临时工作流文件,可在结构收敛后删除或迁移到正式文档。 \ No newline at end of file diff --git a/tmp-service-method-inventory.md b/tmp-service-method-inventory.md new file mode 100644 index 0000000..22fda06 --- /dev/null +++ b/tmp-service-method-inventory.md @@ -0,0 +1,105 @@ +自动生成时间: 2026-03-22T06:43:50.263Z + +扫描范围: app/service/**/*.js +文件数: 50 + +- app/service/api.js (1) + - callMethod +- app/service/apiMethods/test.js (4) + - entryorderConfirm, playbackRequest, fibonacci, fibonacciRecursive +- app/service/dispatcher.js (3) + - buildMap, getMethodMap, invoke +- app/service/main.js (11) + - success, fail, normalizeDate, setInfo, getInfo, findQimenAppWithContract, queryFromDatabase, checkAuth, checkApiPermission, setUserContext, systemInit +- app/service/pda.js (3) + - callMethod, validateParams, saveLog +- app/service/qimen.js (12) + - validateApi, getErpName, parseXmlToArray, cleanXmlString, callMethod, formatResponse, xmlResponse, buildXmlNode, escapeXml, saveQimenLog, saveQimenLogResult, saveQimenLogBody +- app/service/qimenMethods/deliveryorder.js (3) + - query, create, batchcreate +- app/service/qimenMethods/entryorder.js (2) + - create, query +- app/service/qimenMethods/inventory.js (1) + - query +- app/service/qimenMethods/order.js (2) + - cancel, pending +- app/service/qimenMethods/returnorder.js (2) + - create, query +- app/service/qimenMethods/singleitem.js (2) + - synchronize, query +- app/service/qimenMethods/stockout.js (2) + - create, query +- app/service/qimenMethods/taobao/qimen/service.js (1) + - heartbeat +- app/service/system.js (3) + - callMethod, validateParams, saveLog +- app/service/systemMethods/config.js (1) + - list +- app/service/systemMethods/dashboard.js (6) + - storeStats, warehouseStats, hot_order_rank, express_ratio, platform_distribution, order_trend +- app/service/systemMethods/index.js (13) + - fastWhereTree, loadStores, getCOSUploadConfig, getImages, uploadSuccessNotify, ReferenceFile, getMessageDetail, getI18nMessage, putI18nCollect, extractModule, tryAutoTranslateNewKeys, searchSpace, getExpressList +- app/service/systemMethods/order.js (11) + - getWarehouseId, getOrderModels, applyDateRange, buildWhere, parseDateTime, list, detail, listItems, stats, updateStatus, updateDeliveryTime +- app/service/systemMethods/print.js (3) + - send, sendToComputer, log +- app/service/systemMethods/printer/station.js (1) + - list +- app/service/systemMethods/setting/printTemplate.js (3) + - list, save, listTemplatesByType +- app/service/systemMethods/stock.js (21) + - stockWarehouse, getProhibitedType, getInfo, saveWarehouseStock, createWarehouseStock, getBarcodes, saveWarehouseStockBarcode, getStoreStocks, bindItem, unbindItem, checkItemCodeUnique, queryStockLogs, handleBatchDelete, deleteUnit, deleteProhibited, handleBatchChange, getStockUnits, getUnitList, createProhibited, createUnit, search +- app/service/systemMethods/storage/receiving.js (13) + - getReceivingList, getReceivingDetail, batchCancelReceiving, create, addItem, removeItem, saveReceiving, get, addDetail, deleteDetail, detailChange, cancel, completeReceiving +- app/service/systemMethods/store.js (6) + - createStore, createWarehouse, joinStore, joinWarehouse, getStoreRoles, auditApply +- app/service/systemMethods/user.js (5) + - login, logout, info, changeRole, register +- app/service/systemMethods/warehouse.js (20) + - getWarehouseZones, getWarehouseTree, getChildren, create, update, delete, detail, checkBarcodeUnique, toggleActive, getPath, createRack, getPickPath, updateRackPosition, recalculatePickPath, updateNeighbors, getAreaRacks, getSpacesByRack, createRackWithSpaces, getSpaceInfo, updateSpaceInfo +- app/service/systems/account_platform.js (8) + - switchActiveRole, getActiveRoleByPlatform, getMultiplePlatformActiveRoles, getAllPlatformActives, clearPlatformActive, clearPlatformCache, getAvailableRoles, getCurrentContext +- app/service/systems/auth/user.js (21) + - login, ID, changeRole, info, getRoles, findById, setUserCache, getAvatarByEmployeeId, clearUserCache, clearRelatedCache, getPermissions, getMenus, convertToRoutes, findUserByIdentifier, checkUserStatus, verifyPassword, encryptPassword, generateSalt, updateLastLoginTime, ensurePlatformActiveRole, register +- app/service/systems/delivery_order.js (7) + - addOrder, generateItemsHash, calculateCRC32, prepareOrderData, addOrderLines, safeParseFloat, addOrderToQueue +- app/service/systems/entry_order.js (9) + - addOrder, getLineCount, received, success, fail, tryCreateEntryOrder, addItems, qimenEntryorderConfirm, entryorderConfirm +- app/service/systems/fast_where.js (13) + - buildTree, getTreeByType, buildSubTree, getWithChildrenByType, getAllChildren, getByType, getGroups, getChildrenByPid, getTreeChildrenByPid, create, update, findById, delete +- app/service/systems/file.js (2) + - getImages, ReferenceFile +- app/service/systems/location_space.js (16) + - create, batchCreate, list, detail, update, delete, toggleStatus, updateStatus, findAvailableSpaces, findByCode, findByBarcode, getWarehouseStats, getZoneStats, validateAllocation, validateTransferOut, _validateReferences +- app/service/systems/location_zone.js (22) + - getWarehouseLevelZones, getZoneTreeByWarehouse, getChildrenByZoneId, isLeafNode, createZone, validateBasicFields, validateByZoneType, validateParentElement, validateZoneOverlap, isOverlap, generateZoneCodeByType, getDefaultColorByType, getZoneTypeText, updateZone, deleteZone, checkZoneOverlap, getZoneDetail, toggleZoneActive, getZonePath, generateSpacesForRack, getSpaceInfo, checkBarcodeUnique +- app/service/systems/location.js (10) + - createRackWithSpaces, _generateSpacesForRack, _calculateAreaRackOrder, _calculatePickPathForWarehouse, _updateSpacePickSequence, _calculatePickPriority, updateRackPosition, getPickPath, updateNeighborRelations, _findNeighborRacks +- app/service/systems/notification.js (1) + - send +- app/service/systems/operation_log.js (4) + - createOperationLog, queryStockLogs, queryOrderLogs, getMessageDetail +- app/service/systems/platform.js (6) + - checkPlatformExists, getPlatformInfo, clearPlatformCache, getPlatformSettingDetail, batchCheckPlatforms, createPlatformSetting +- app/service/systems/polo_api.js (6) + - getJsonDatas, getJsonData, getSignText, md5Encrypt, _formatDate, _formatPickupDate +- app/service/systems/print/index.js (2) + - sendToComputer, test +- app/service/systems/qimen_query.js (6) + - send, replaceXmlTagsWithString, addSign, getQueryParams, generateUrlWithParams, sendRequest +- app/service/systems/setting/print_template.js (14) + - listTemplatesByType, getTree, getTemplatesByType, save, getBusinessTypesAndItem, getGroupedPrintItems, getTableConfigs, clearBusinessTypesCache, getXmlByTemplate, buildXmlFromElements, renderElement, computeItemStyle, computeTableItemStyle, renderTable +- app/service/systems/sign.js (10) + - Constants, toXml, signTopRequest, verifyTopRequest, verifyAndExtractParams, generateSignedParams, encryptHMAC, encryptHMACSHA256, encryptMD5, byte2hex +- app/service/systems/space.js (1) + - searchSpace +- app/service/systems/stock_store.js (34) + - create, initQimenStockData, convertToQimenFormat, getItemInfoWithCache, getItemStorages, _calculateCacheTTL, clearItemStorageCache, lockItemStorages, ID, inbound, outbound, checkAndCreateWarehouseStock, getWarehouseStock, buildSequelizeCondition, processConditionValue, formatDate, isEmptyValue, getProhibitedType, getBarcodes, handleBatchChange, saveWarehouseStockBarcode, getStoreStocks, bindItem, unbindItem, getInfo, saveWarehouseStock, createWarehouseStock, validateSaveParams, stockLog, checkItemCodeUnique, handleBatchDelete, deleteUnit, deleteProhibited, search +- app/service/systems/storage/index.js (1) + - index +- app/service/systems/storage/receiving.js (16) + - getReceivingList, getReceivingDetail, batchCancelReceiving, isEmptyValue, buildSequelizeCondition, processConditionValue, create, get, addDetail, updateDetail, getStockStoreInfo, updateReceivingStats, deleteDetail, detailChange, invalid, completeReceiving +- app/service/systems/store.js (13) + - getStoreName, getStoreRemaskName, createStore, createWarehouse, joinStore, joinWarehouse, assignAdminRoleToCreator, generateJoinToken, sendNotification, sendNotificationToAdmins, getStoreRoles, auditApply, loadStores +- app/service/systems/upload.js (14) + - initCOS, getUploadParams, hash_hmac, validateFileInfo, generateFileName, parseSizeToBytes, formatFileSize, getFrontendConfig, uploadFile, validateFile, uploadSuccessNotify, getMimeType, createFileReference, handleUploadCallback