ok
This commit is contained in:
parent
460ce119c5
commit
e73a311076
1
.codebuddy/.gitignore
vendored
Normal file
1
.codebuddy/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
db/
|
||||
1
.github/agents/文档.agent.md
vendored
1
.github/agents/文档.agent.md
vendored
@ -38,6 +38,7 @@ model: GPT-5 mini (copilot)
|
||||
- 公共请求头变化
|
||||
- 鉴权方式变化
|
||||
- 每次 API 接口变更(新增 / 修改 / 删除 method、参数、响应、错误码、header、鉴权等)后,除了更新 `methods/*.json` / `docs/*.md`,**还必须追加一条变更记录到对应的 `methods/changes/<docName>.json` 数组**
|
||||
- 修补json文件时必须强校验 JSON格式的正确性,确保不会引入格式错误导致无法解析的情况
|
||||
- `methods/*.json` 仍是 SSOT,`methods/changes/*.json` 仅记录差异历史
|
||||
- 变更记录建议字段至少包含:`version`、`date`、`summary`、`methods`、`notes`
|
||||
5. 如 system 入参有变化,可执行:
|
||||
|
||||
10
.github/agents/测试.agent.md
vendored
10
.github/agents/测试.agent.md
vendored
@ -3,7 +3,7 @@ name: wms-test-agent
|
||||
description: "Use when the user asks about 测试、单元测试、集成测试、回归测试、TDD、接口验证、mock、覆盖率、验证修复、复现 bug。专用于 WMS 测试设计、执行与验证。"
|
||||
argument-hint: "描述要验证或补齐的测试目标,例如:补某接口单元测试、复现 bug 并加回归、按 TDD 验证修复、审查 mock/断言是否合理。"
|
||||
tools: ['read', 'search', 'edit', 'execute', 'todo']
|
||||
model: GPT-5.1 (copilot)
|
||||
model: Gemini 2.5 Pro (copilot)
|
||||
---
|
||||
|
||||
# WMS 测试代理(`wms-test-agent`)
|
||||
@ -39,13 +39,13 @@ model: GPT-5.1 (copilot)
|
||||
## 测试规则
|
||||
|
||||
1. **TDD 优先**:先写失败用例,再做最小修复
|
||||
2. **测试真实行为**:优先验证真实输入/输出与实际调用链,不要只测 mock
|
||||
2. **测试真实行为**:优先验证真实输入/输出与实际调用链,不要只测 mock,测试所有的文件是否符合eslint规范,不规范的代码必须驳回修改后再验证,并告知驳回原因
|
||||
3. **禁止 test-only 生产代码**:不要为测试给生产代码加仅供测试使用的方法或分支
|
||||
4. **mock 要克制且完整**:仅在理解依赖副作用后于最低必要层 mock,且结构必须与真实数据一致
|
||||
5. **改动后必须验证**:跑相关测试并明确报告 passing 数量、失败数与验证范围
|
||||
6. **接口验证以真实链路为准**:必要时结合 `methods/*.json`、controller/service 实现与返回结构共同校验
|
||||
7. **所有编码风格必须要通过ESLint检查**,禁止任何 ESLint 错误或警告存在于提交的代码中,如有 ESLint 错误或警告,必须驳回到开发修改后再验证
|
||||
|
||||
8. **测试仓库与货主范围固定** 必须检查测试中创建的资源(如收货单、绑定货主等)是否使用了固定的测试仓库 ID `100000` 和测试货主 ID `1000000`,禁止使用随机生成的仓库或货主 ID 以及其他非固定值,否则必须驳回修改后再验证,并告知驳回原因。
|
||||
## 常用命令示例
|
||||
|
||||
### PowerShell 执行
|
||||
@ -78,7 +78,9 @@ npx egg-bin test test/app/controller/**/*.test.js
|
||||
- 所有回复建议以 `[Test]` 开头
|
||||
- 先给结论,再给测试范围、关键用例、验证结果
|
||||
- 明确说明 passing 数量、失败数与是否已覆盖回归场景
|
||||
|
||||
- 直接输出测试报告到 `test_reports/` 目录下的文件中,测试分为可以通过和不可以通过部分,分别为 `test_reports/pass/` 和 `test_reports/fail/`,测试完成后并返回文件路径,报告路径必须包含日期时间和中文描述,例如:`test_reports/pass/20260410-货主超卖链路测试报告.md`
|
||||
- 如有失败用例,必须明确失败原因、失败用例名称与代码位置
|
||||
- 测试报告格式必须清晰、结构化,包含测试目标、测试范围、测试产物、测试结果摘要、结论与建议,测试类型(单元/集成/回归/接口验证)必须明确标注
|
||||
## 结论
|
||||
|
||||
测试相关能力文档已统一收口到本 Agent;工具箱只保留“测试相关必须使用 `wms-test-agent`”的规则入口。
|
||||
|
||||
63
.github/agents/评审.agent.md
vendored
Normal file
63
.github/agents/评审.agent.md
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
---
|
||||
name: wms-review-agent
|
||||
description: "Use when the user asks for 代码评审、审查、review、缺陷、风险、回归、兼容性、可维护性、代码质量检查、变更影响分析。专用于 WMS 只读代码评审与风险识别。"
|
||||
argument-hint: "描述要评审的代码、分支或变更范围,例如:评审某个 PR、审查某个接口改动、检查回归风险、分析兼容性问题。"
|
||||
tools: ['read', 'search']
|
||||
model: Claude Opus 4.6
|
||||
---
|
||||
|
||||
# WMS 评审代理(`wms-review-agent`)
|
||||
|
||||
## 适用范围
|
||||
|
||||
- 项目根目录:`D:\wms`
|
||||
- 主要关注目录:`app/`、`config/`、`database/`、`test/`、`methods/`
|
||||
- 适用于代码评审、变更审查、风险分析、回归影响判断与可维护性检查
|
||||
|
||||
## 角色定位
|
||||
|
||||
本代理只做只读评审,不进行任何代码修改、文件写入、格式化、重构或执行类操作。
|
||||
|
||||
## 评审重点
|
||||
|
||||
1. **缺陷**:逻辑错误、边界条件遗漏、异常处理不足、空值与并发问题
|
||||
2. **风险**:回归风险、兼容性风险、权限与数据安全风险、性能退化风险
|
||||
3. **回归点**:接口行为变化、状态流转变化、数据结构变化、默认值变化
|
||||
4. **可维护性**:职责是否清晰、耦合是否过高、命名是否准确、重复逻辑是否明显
|
||||
5. **一致性**:实现与既有分层约定、既有模式、既有测试和文档是否一致
|
||||
|
||||
## 评审规则
|
||||
|
||||
1. **只读评审**:只允许阅读和检索,不做任何修改
|
||||
2. **先找事实**:基于代码、调用链、测试和上下文给出结论,不凭空猜测
|
||||
3. **优先指出问题**:发现问题时要明确说明影响范围、触发条件和严重程度
|
||||
4. **避免泛泛而谈**:每条 findings 都要能对应到具体代码位置或明确行为
|
||||
5. **必要时说明未验证项**:如果无法确认某个点,必须标注为开放问题或残余风险
|
||||
|
||||
## 输出要求
|
||||
|
||||
- 先列出 findings,再列残余风险或开放问题
|
||||
- findings 必须按严重程度排序,优先级高的放前面
|
||||
- 每条 finding 需要包含问题、影响、依据,最好附带代码位置
|
||||
- 如果没有发现问题,要明确说明“未发现明确缺陷”或同义结论
|
||||
- 结尾可给出简短结论,但不要把结论放在 findings 之前
|
||||
|
||||
## 建议提问方式
|
||||
|
||||
```text
|
||||
请使用 wms-review-agent 帮我:
|
||||
1) 评审这个变更的缺陷和回归风险
|
||||
2) 检查兼容性、边界条件和可维护性
|
||||
3) 先输出 findings,再输出残余风险或开放问题
|
||||
```
|
||||
|
||||
## 输出风格
|
||||
|
||||
- 所有回复建议以 `[Review]` 开头
|
||||
- 语气保持直接、准确、可执行
|
||||
- 不输出代码修改建议为最终动作,不执行修复
|
||||
- 如需后续修复,建议交由开发类 agent 处理
|
||||
|
||||
## 结论
|
||||
|
||||
本代理专用于只读代码评审与风险识别;工具箱仅保留 `read` 与 `search`,禁止任何修改或执行类能力。
|
||||
2
.github/agents/调度.agent.md
vendored
2
.github/agents/调度.agent.md
vendored
@ -23,7 +23,7 @@ model: GPT-5.4 mini (copilot)
|
||||
2. **Redis / 缓存 / TTL / session / key 排障** → `wms-redis-agent`
|
||||
3. **发布 / 回退 / 预检 / 冒烟 / 版本查询** → `wms-deploy-agent`
|
||||
4. **文档补充 / API 文档 / README / `methods/*.json` / `docs/*.md`** → `wms-doc-agent`
|
||||
5. **测试 / 回归 / 接口验证 / TDD / mock 审查** → `wms-test-agent`
|
||||
5. **测试 / 回归 / 接口验证 / TDD / mock 审查** → `wms-test-agent` 必须告知测试目标和所有涉及的文件路径
|
||||
6. **纯代码修改 / method 映射 / 权限联动** → `wms-dev-agent`
|
||||
7. **代码 + 文档混合变更** → 必须拆分为两个子任务:先委派 `wms-dev-agent` 完成代码修改,再委派 `wms-doc-agent` 完成 `methods/*.json` 更新和 `methods/changes/*.json` 变更记录。**禁止将文档修改合并到 `wms-dev-agent` 的任务中**
|
||||
8. **专属 agent 处理不了,或多次迭代仍未解决** → 升级委派 `wms-expert-agent` 进行兜底处理(root cause + 端到端闭环)
|
||||
|
||||
9
app.js
9
app.js
@ -1,12 +1,19 @@
|
||||
// app.js
|
||||
const path = require('path');
|
||||
const LocalFileWriter = require('./app/lib/file_writer');
|
||||
|
||||
// 直接导出函数,而不是类
|
||||
/**
|
||||
* 挂载应用级扩展能力。
|
||||
* @param {import('egg').Application} app Egg 应用实例。
|
||||
* @return {void}
|
||||
*/
|
||||
module.exports = app => {
|
||||
// 设置全局应用根目录
|
||||
global.APP_ROOT = path.resolve(__dirname, './');
|
||||
app.appRoot = global.APP_ROOT;
|
||||
app.fileWriter = new LocalFileWriter(app);
|
||||
app.logger.info('✅ Application 扩展能力已加载');
|
||||
app.logger.info('✅ fileWriter 已挂载到 app.fileWriter');
|
||||
// 初始化工厂
|
||||
app.beforeStart(async () => {
|
||||
// skip factory init when model layer is absent (e.g. during tests)
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
const crypto = require('crypto');
|
||||
const {
|
||||
Controller,
|
||||
} = require('egg');
|
||||
@ -20,9 +21,12 @@ class HomeController extends Controller {
|
||||
service,
|
||||
} = this;
|
||||
const startTime = Date.now();
|
||||
const logId = 'QL-' + Date.now() + '-' + crypto.randomBytes(3).toString('hex');
|
||||
ctx.qimenLogId = logId;
|
||||
|
||||
// 初始化日志数据
|
||||
const logData = {
|
||||
log_id: logId,
|
||||
from_key: '',
|
||||
to_key: this.app.config.qimen.appKey,
|
||||
method: '',
|
||||
@ -42,14 +46,12 @@ class HomeController extends Controller {
|
||||
logData.sign = getParams.sign || '';
|
||||
logData.costomer_id = getParams.customerId || getParams.customer_id || '';
|
||||
logData.v = getParams.v || '';
|
||||
ctx.qimenLogId = await service.qimen.saveQimenLog(logData, startTime);
|
||||
try {
|
||||
|
||||
// 验证必要参数
|
||||
if (!this.validateQimenParams(getParams)) {
|
||||
const errorMsg = '参数缺失或错误';
|
||||
const response = this.errorResponse(errorMsg, 'xml');
|
||||
await service.qimen.saveQimenLogResult(response);
|
||||
ctx.body = response;
|
||||
ctx.type = 'application/xml';
|
||||
return;
|
||||
@ -97,7 +99,7 @@ class HomeController extends Controller {
|
||||
xmlArray.app_key = appkey;
|
||||
let warehouseCode = xmlArray.request.warehouseCode || '';
|
||||
|
||||
await service.qimen.saveQimenLogBody(xmlData);
|
||||
logData.body = xmlData;
|
||||
const erpName = await service.qimen.getErpName(appkey);
|
||||
let api_info = {
|
||||
warehouseCode: '',
|
||||
@ -119,7 +121,6 @@ class HomeController extends Controller {
|
||||
if (!api_info) {
|
||||
const errorMsg = `奇门${erpName}客户编码${customerId}仓库编码${warehouseCode}未绑定到你的货主或未启用,请联系仓库绑定`;
|
||||
const response = this.errorResponse(errorMsg, 'xml');
|
||||
await service.qimen.saveQimenLogResult(response);
|
||||
ctx.body = response;
|
||||
ctx.type = 'application/xml';
|
||||
return;
|
||||
@ -127,7 +128,6 @@ class HomeController extends Controller {
|
||||
if (api_info.contract_auth_status !== 2) {
|
||||
const errorMsg = `货主与仓库签约状态异常,请到WMS核实签约状态${api_info.contract_auth_status}`;
|
||||
const response = this.errorResponse(errorMsg, 'xml');
|
||||
await service.qimen.saveQimenLogResult(response);
|
||||
ctx.body = response;
|
||||
ctx.type = 'application/xml';
|
||||
return;
|
||||
@ -135,8 +135,6 @@ class HomeController extends Controller {
|
||||
if (api_info.warehouse_status === 0) {
|
||||
const errorMsg = '仓库状态异常,请联系仓库核实WMS状态';
|
||||
const response = this.errorResponse(errorMsg, 'xml');
|
||||
await service.qimen.saveQimenLogResult(response);
|
||||
|
||||
ctx.body = response;
|
||||
ctx.type = 'application/xml';
|
||||
return;
|
||||
@ -147,8 +145,6 @@ class HomeController extends Controller {
|
||||
if (authEndTime2 < currentTime) {
|
||||
const errorMsg = '与仓库合约过期,请到WMS重新发起仓库续约';
|
||||
const response = this.errorResponse(errorMsg, 'xml');
|
||||
await service.qimen.saveQimenLogResult(response);
|
||||
|
||||
ctx.body = response;
|
||||
ctx.type = 'application/xml';
|
||||
return;
|
||||
@ -156,8 +152,6 @@ class HomeController extends Controller {
|
||||
if (authEndTime < currentTime) {
|
||||
const errorMsg = '仓库订阅过期,请联系仓库核实状态';
|
||||
const response = this.errorResponse(errorMsg, 'xml');
|
||||
await service.qimen.saveQimenLogResult(response);
|
||||
|
||||
ctx.body = response;
|
||||
ctx.type = 'application/xml';
|
||||
return;
|
||||
@ -167,17 +161,29 @@ class HomeController extends Controller {
|
||||
// 调用业务方法
|
||||
const result = await service.qimen.callMethod(className, actionName, xmlArray, api_info.store_id,
|
||||
api_info.warehouse_id, appkey, customerId, warehouseCode, getParams.format);
|
||||
// 记录成功响应
|
||||
const logData_result = typeof result === 'string' ? result : JSON.stringify(result);
|
||||
await service.qimen.saveQimenLogResult(logData_result);
|
||||
|
||||
ctx.body = result;
|
||||
ctx.type = getParams.format === 'xml' ? 'application/xml' : 'application/json';
|
||||
} catch (error) {
|
||||
const response = this.errorResponse('奇门接口错误: ' + error.message, ctx.query.format || 'xml');
|
||||
await service.qimen.saveQimenLogResult(response);
|
||||
ctx.body = response;
|
||||
ctx.type = ctx.query.format === 'xml' ? 'application/xml' : 'application/json';
|
||||
} finally {
|
||||
// 统一写入日志文件队列
|
||||
logData.use_time = Date.now() - startTime;
|
||||
logData.result = typeof ctx.body === 'string' ? ctx.body : JSON.stringify(ctx.body);
|
||||
if (logData.body && logData.body.length > 65535) {
|
||||
logData.body = logData.body.substring(0, 65535);
|
||||
}
|
||||
if (logData.result && logData.result.length > 65535) {
|
||||
logData.result = logData.result.substring(0, 65535);
|
||||
}
|
||||
try {
|
||||
await this.app.fileWriter.writeRecord('qimen-logs', logData);
|
||||
} catch (writeErr) {
|
||||
ctx.logger.error('[qimen-log-sink] 写入文件失败: ' + writeErr.message);
|
||||
ctx.logger.info('[qimen-log-sink] 日志数据: ', JSON.stringify(logData));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
61
app/controller/tempFileWriter.js
Normal file
61
app/controller/tempFileWriter.js
Normal file
@ -0,0 +1,61 @@
|
||||
'use strict';
|
||||
|
||||
const {
|
||||
Controller,
|
||||
} = require('egg');
|
||||
const { toFailure, toSuccess } = require('../lib/api_response');
|
||||
|
||||
class TempFileWriterController extends Controller {
|
||||
/**
|
||||
* 触发一次临时 fileWriter 消费,并返回本次消费结果。
|
||||
* @return {Promise<void>} 无返回值,结果写入响应体。
|
||||
*/
|
||||
async consume() {
|
||||
const { ctx, app } = this;
|
||||
const { businessName, consumerName } = ctx.query;
|
||||
|
||||
if (!businessName) {
|
||||
ctx.status = 400;
|
||||
ctx.body = toFailure({
|
||||
httpStatus: 400,
|
||||
message: 'businessName 不能为空',
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const progressFilePath = app.fileWriter.getProgressFilePath(
|
||||
businessName,
|
||||
null,
|
||||
consumerName || 'temp-http-consumer'
|
||||
);
|
||||
const consumedRecords = [];
|
||||
|
||||
try {
|
||||
const result = await app.fileWriter.consumeFiles({
|
||||
businessName,
|
||||
progressFilePath,
|
||||
parseJson: ctx.query.parseJson !== 'false',
|
||||
onRecord: async record => {
|
||||
consumedRecords.push(record);
|
||||
},
|
||||
});
|
||||
|
||||
ctx.body = toSuccess({
|
||||
businessName,
|
||||
progressFilePath,
|
||||
consumedRecords,
|
||||
processedCount: result.processedCount,
|
||||
progress: result.progress,
|
||||
dataFiles: result.dataFiles,
|
||||
});
|
||||
} catch (error) {
|
||||
ctx.status = error && error.message === 'businessName 不能为空' ? 400 : 500;
|
||||
ctx.body = toFailure({
|
||||
httpStatus: ctx.status,
|
||||
message: error.message,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = TempFileWriterController;
|
||||
1497
app/lib/file_writer.js
Normal file
1497
app/lib/file_writer.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -380,6 +380,12 @@ module.exports = app => {
|
||||
defaultValue: 'none',
|
||||
comment: '检验状态机',
|
||||
},
|
||||
step: {
|
||||
type: INTEGER(10),
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: '订单步骤:0未审核,1已审核,2处理中,3驳回/异常,4配送中,5已完成,9已关闭',
|
||||
},
|
||||
print_status: {
|
||||
type: ENUM(...StatusEnum.PRINT_STATUS),
|
||||
allowNull: true,
|
||||
|
||||
@ -348,6 +348,7 @@ module.exports = app => {
|
||||
\`pick_status\` enum('padding','fin','error','none') DEFAULT 'none' COMMENT '拣货状态机',
|
||||
\`pack_status\` enum('none','padding','fin','error') DEFAULT 'none' COMMENT '打包状态机',
|
||||
\`inspection_status\` enum('none','padding','running','fin','error') DEFAULT 'none' COMMENT '检验状态机',
|
||||
\`step\` int(10) NOT NULL DEFAULT '0' COMMENT '订单步骤:0未审核,1已审核',
|
||||
\`print_status\` enum('none','padding','fin','error') DEFAULT NULL COMMENT '打印状态机',
|
||||
\`claim_status\` enum('none','padding','fin','error') DEFAULT 'none' COMMENT '领取状态机',
|
||||
\`outbound_status\` enum('none','padding','fin','error') DEFAULT 'none' COMMENT '出库状态机',
|
||||
@ -383,6 +384,7 @@ module.exports = app => {
|
||||
pick_status: [ 'padding', 'fin', 'error', 'none' ],
|
||||
pack_status: [ 'none', 'padding', 'fin', 'error' ],
|
||||
inspection_status: [ 'none', 'padding', 'running', 'fin', 'error' ],
|
||||
step: [ 0, 1 ],
|
||||
print_status: [ 'none', 'padding', 'fin', 'error' ],
|
||||
claim_status: [ 'none', 'padding', 'fin', 'error' ],
|
||||
outbound_status: [ 'none', 'padding', 'fin', 'error' ],
|
||||
|
||||
@ -11,6 +11,12 @@ module.exports = app => {
|
||||
primaryKey: true,
|
||||
autoIncrement: true,
|
||||
},
|
||||
log_id: {
|
||||
type: STRING(32),
|
||||
allowNull: true,
|
||||
unique: true,
|
||||
field: 'log_id',
|
||||
},
|
||||
from_key: {
|
||||
type: INTEGER(10),
|
||||
allowNull: true,
|
||||
|
||||
@ -146,12 +146,12 @@ module.exports = app => {
|
||||
comment: '删除时间',
|
||||
},
|
||||
quantity: {
|
||||
type: INTEGER(11).UNSIGNED,
|
||||
type: INTEGER(11),
|
||||
defaultValue: 0,
|
||||
comment: '库存数量',
|
||||
},
|
||||
locked_quantity: {
|
||||
type: INTEGER(11).UNSIGNED,
|
||||
type: INTEGER(11),
|
||||
defaultValue: 0,
|
||||
comment: '锁定数量',
|
||||
},
|
||||
|
||||
@ -46,6 +46,22 @@ module.exports = app => {
|
||||
required: false,
|
||||
description: '是否允许进入临时存放区',
|
||||
}),
|
||||
Object.freeze({
|
||||
key: 'allow_oversell',
|
||||
name: '允许超卖',
|
||||
type: 'flag',
|
||||
default: 0,
|
||||
required: false,
|
||||
description: '是否允许该货主在当前仓库下锁定超过可用库存',
|
||||
}),
|
||||
Object.freeze({
|
||||
key: 'need_order_approval',
|
||||
name: '推送订单需审批',
|
||||
type: 'flag',
|
||||
default: 1,
|
||||
required: false,
|
||||
description: '控制货主推送订单创建后是否必须进入审批流程',
|
||||
}),
|
||||
Object.freeze({
|
||||
key: 'print_recharge_price',
|
||||
name: '面单充值元/单',
|
||||
|
||||
@ -27,6 +27,9 @@ module.exports = app => {
|
||||
router.get('/auth/printSetting/:code', controller.auth.printerSetting);
|
||||
router.post('/auth/printSetting/', controller.auth.printerSetting);
|
||||
|
||||
// 临时 fileWriter 消费入口
|
||||
router.get('/__temp/file-writer/consume', controller.tempFileWriter.consume);
|
||||
|
||||
// 测试接口
|
||||
router.get('/testSendData', controller.home.testSendData);
|
||||
};
|
||||
|
||||
61
app/schedule/consume_qimen_logs.js
Normal file
61
app/schedule/consume_qimen_logs.js
Normal file
@ -0,0 +1,61 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
|
||||
/**
|
||||
* 定时消费奇门日志文件队列,逐条插入数据库。
|
||||
* 间隔 30 秒执行,type: worker(仅一个 worker 执行)。
|
||||
* 使用 fileWriter.consumeFiles 内置的逐条进度追踪,
|
||||
* 任一记录插入失败即停止,下次从失败位置重试。
|
||||
*/
|
||||
module.exports = {
|
||||
schedule: {
|
||||
interval: '30s',
|
||||
type: 'worker',
|
||||
immediate: false,
|
||||
disable: false,
|
||||
},
|
||||
|
||||
async task(ctx) {
|
||||
// 防止重入
|
||||
if (ctx.app._consumeQimenLogsRunning) return;
|
||||
ctx.app._consumeQimenLogsRunning = true;
|
||||
|
||||
const fileWriter = ctx.app.fileWriter;
|
||||
const mysql = ctx.app.mysql.get('wms');
|
||||
const progressFilePath = path.join(fileWriter.baseDir, 'qimen-logs', '.consume-progress');
|
||||
|
||||
try {
|
||||
const result = await fileWriter.consumeFiles({
|
||||
businessName: 'qimen-logs',
|
||||
progressFilePath,
|
||||
maxConsumeRecordsPerWindow: 500,
|
||||
parseJson: true,
|
||||
onRecord: async record => {
|
||||
await mysql.insert('wms_qimen_log', {
|
||||
log_id: record.log_id || null,
|
||||
from_key: record.from_key || '',
|
||||
to_key: record.to_key || '',
|
||||
method: record.method || '',
|
||||
sign: record.sign || '',
|
||||
costomer_id: record.costomer_id || '',
|
||||
v: record.v || '',
|
||||
url: record.url || '',
|
||||
created_at: record.created_at ? new Date(record.created_at) : new Date(),
|
||||
body: record.body || '',
|
||||
result: record.result || '',
|
||||
use_time: record.use_time || 0,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
if (result.processedCount > 0) {
|
||||
ctx.logger.info(`[consume-qimen-logs] 消费 ${result.processedCount} 条日志`);
|
||||
}
|
||||
} catch (err) {
|
||||
ctx.logger.error(`[consume-qimen-logs] 消费失败: ${err.message}`);
|
||||
} finally {
|
||||
ctx.app._consumeQimenLogsRunning = false;
|
||||
}
|
||||
},
|
||||
};
|
||||
@ -50,7 +50,7 @@ class indexService extends MainService {
|
||||
* @param {string} data.base64 base64 图片
|
||||
* @param {string} [data.imageBase64] 兼容的 base64 字段
|
||||
* @param {string} [data.image_base64] 兼容的 base64 字段
|
||||
* @returns {Promise<Object>} 识别结果
|
||||
* @return {Promise<Object>} 识别结果
|
||||
*/
|
||||
async recognizeLicensePlate(data) {
|
||||
const { service, ctx } = this;
|
||||
|
||||
@ -12,6 +12,12 @@ class ArchiveOrderService extends OrderBaseService {
|
||||
this.systemInit(_noNeedLogin, _noNeedRight, _noNeedLog, _noNeedAuth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取归档订单列表。
|
||||
*
|
||||
* @param {Object} data 请求参数。
|
||||
* @return {Promise<Object>} 查询结果。
|
||||
*/
|
||||
async getarchiveOrderlist(data = {}) {
|
||||
try {
|
||||
const warehouseId = this.ensureWarehouseId(data);
|
||||
@ -32,6 +38,7 @@ class ArchiveOrderService extends OrderBaseService {
|
||||
'id',
|
||||
'delivery_order_code',
|
||||
'status',
|
||||
'step',
|
||||
'outbound_status',
|
||||
'delivery_time',
|
||||
'updated_at',
|
||||
|
||||
@ -67,6 +67,13 @@ class OrderBaseService extends MainService {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建订单列表查询条件。
|
||||
*
|
||||
* @param {Object} whereData where 过滤参数。
|
||||
* @param {number} warehouseId 仓库 ID。
|
||||
* @return {Object} Sequelize 查询条件。
|
||||
*/
|
||||
buildWhere(whereData = {}, warehouseId) {
|
||||
const { Op } = this.app.Sequelize;
|
||||
const where = { warehouse_id: warehouseId };
|
||||
@ -85,6 +92,7 @@ class OrderBaseService extends MainService {
|
||||
'outbound_status',
|
||||
'lock_status',
|
||||
'intercept_status',
|
||||
'step',
|
||||
'source_platform_code',
|
||||
'logistics_code',
|
||||
'warehouse_code',
|
||||
|
||||
@ -12,6 +12,12 @@ class DeliveryOrderService extends OrderBaseService {
|
||||
this.systemInit(_noNeedLogin, _noNeedRight, _noNeedLog, _noNeedAuth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已发货订单列表。
|
||||
*
|
||||
* @param {Object} data 请求参数。
|
||||
* @return {Promise<Object>} 查询结果。
|
||||
*/
|
||||
async getdeliveryOrderlist(data = {}) {
|
||||
try {
|
||||
const warehouseId = this.ensureWarehouseId(data);
|
||||
@ -33,6 +39,7 @@ class DeliveryOrderService extends OrderBaseService {
|
||||
'id',
|
||||
'delivery_order_code',
|
||||
'status',
|
||||
'step',
|
||||
'outbound_status',
|
||||
'delivery_time',
|
||||
'updated_at',
|
||||
|
||||
@ -12,6 +12,12 @@ class ExpectionOrderService extends OrderBaseService {
|
||||
this.systemInit(_noNeedLogin, _noNeedRight, _noNeedLog, _noNeedAuth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取异常订单列表。
|
||||
*
|
||||
* @param {Object} data 请求参数。
|
||||
* @return {Promise<Object>} 查询结果。
|
||||
*/
|
||||
async getexpectionOrderlist(data = {}) {
|
||||
try {
|
||||
const warehouseId = this.ensureWarehouseId(data);
|
||||
@ -56,6 +62,7 @@ class ExpectionOrderService extends OrderBaseService {
|
||||
'id',
|
||||
'delivery_order_code',
|
||||
'status',
|
||||
'step',
|
||||
'post_status',
|
||||
'pick_status',
|
||||
'pack_status',
|
||||
|
||||
@ -134,6 +134,12 @@ class OrderIndexService extends OrderBaseService {
|
||||
return await this.ctx.service.systemMethods.order.reviewOrder.getreviewOrderlist(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新订单状态相关字段。
|
||||
*
|
||||
* @param {Object} data 请求参数。
|
||||
* @return {Promise<Object>} 更新结果。
|
||||
*/
|
||||
async updateStatus(data = {}) {
|
||||
try {
|
||||
const warehouseId = this.ensureWarehouseId(data);
|
||||
@ -152,6 +158,7 @@ class OrderIndexService extends OrderBaseService {
|
||||
'outbound_status',
|
||||
'lock_status',
|
||||
'intercept_status',
|
||||
'step',
|
||||
];
|
||||
|
||||
const updateData = {};
|
||||
|
||||
@ -12,6 +12,12 @@ class PendingOrderService extends OrderBaseService {
|
||||
this.systemInit(_noNeedLogin, _noNeedRight, _noNeedLog, _noNeedAuth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取待处理订单列表。
|
||||
*
|
||||
* @param {Object} data 请求参数。
|
||||
* @return {Promise<Object>} 查询结果。
|
||||
*/
|
||||
async getpendingOrderlist(data = {}) {
|
||||
try {
|
||||
const warehouseId = this.ensureWarehouseId(data);
|
||||
@ -38,6 +44,7 @@ class PendingOrderService extends OrderBaseService {
|
||||
'id',
|
||||
'delivery_order_code',
|
||||
'status',
|
||||
'step',
|
||||
'outbound_status',
|
||||
'inspection_status',
|
||||
'updated_at',
|
||||
|
||||
@ -12,6 +12,33 @@ class ReviewOrderService extends OrderBaseService {
|
||||
this.systemInit(_noNeedLogin, _noNeedRight, _noNeedLog, _noNeedAuth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将审核状态映射为订单步骤。
|
||||
*
|
||||
* @param {string} reviewStatus 审核状态。
|
||||
* @return {number} 订单步骤值。
|
||||
*/
|
||||
mapReviewStatusToStep(reviewStatus) {
|
||||
const status = String(reviewStatus || 'none').trim();
|
||||
|
||||
if (status === 'fin') {
|
||||
return 1;
|
||||
}
|
||||
if (status === 'running' || status === 'padding') {
|
||||
return 2;
|
||||
}
|
||||
if (status === 'error') {
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取待审核订单列表。
|
||||
*
|
||||
* @param {Object} data 请求参数。
|
||||
* @return {Promise<Object>} 查询结果。
|
||||
*/
|
||||
async getreviewOrderlist(data = {}) {
|
||||
try {
|
||||
const warehouseId = this.ensureWarehouseId(data);
|
||||
@ -45,6 +72,7 @@ class ReviewOrderService extends OrderBaseService {
|
||||
'id',
|
||||
'delivery_order_code',
|
||||
'status',
|
||||
'step',
|
||||
'inspection_status',
|
||||
'operator_name',
|
||||
'operate_time',
|
||||
@ -73,6 +101,12 @@ class ReviewOrderService extends OrderBaseService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新订单审核状态。
|
||||
*
|
||||
* @param {Object} data 请求参数。
|
||||
* @return {Promise<Object>} 更新结果。
|
||||
*/
|
||||
async reviewOrder(data = {}) {
|
||||
try {
|
||||
const warehouseId = this.ensureWarehouseId(data);
|
||||
@ -89,6 +123,7 @@ class ReviewOrderService extends OrderBaseService {
|
||||
|
||||
const updateData = {
|
||||
inspection_status: reviewStatus,
|
||||
step: this.mapReviewStatusToStep(reviewStatus),
|
||||
operator_name: data.operator_name || this.ctx.user?.real_name || this.ctx.user?.username || null,
|
||||
operate_time: data.operate_time ? this.parseDateTime(data.operate_time, 'operate_time') : new Date(),
|
||||
updated_at: new Date(),
|
||||
|
||||
@ -22,6 +22,10 @@ class StorageStockoutService extends OrderBaseService {
|
||||
this.prepareWhereContext(data);
|
||||
const whereData = this.ctx.where || {};
|
||||
const where = this.buildWhere(whereData, warehouseId);
|
||||
// 默认只查询订单类型为 STOCKOUT 的出库单
|
||||
if (!whereData.order_type && !where.order_type) {
|
||||
where.order_type = 'STOCKOUT';
|
||||
}
|
||||
const { page, pageSize, offset } = this.getPagination(data.pagination);
|
||||
|
||||
const result = await DeliveryModel.findAndCountAll({
|
||||
|
||||
@ -1,7 +1,24 @@
|
||||
'use strict';
|
||||
const Service = require('egg').Service;
|
||||
|
||||
const DELIVERY_ORDER_STEP = Object.freeze({
|
||||
PENDING_REVIEW: 0,
|
||||
APPROVED: 1,
|
||||
PROCESSING: 2,
|
||||
REJECTED_OR_EXCEPTION: 3,
|
||||
OUTBOUND_OR_DELIVERING: 4,
|
||||
COMPLETED: 5,
|
||||
CLOSED: 9,
|
||||
});
|
||||
|
||||
class DeliveryOrderService extends Service {
|
||||
/**
|
||||
* 创建发货单。
|
||||
*
|
||||
* @param {Object} data 奇门/系统订单入参。
|
||||
* @param {Object} info 当前仓库与货主上下文。
|
||||
* @return {Promise<Object>} 创建结果。
|
||||
*/
|
||||
async addOrder(data, info) {
|
||||
const { ctx } = this;
|
||||
if (!info.warehouseId) {
|
||||
@ -45,7 +62,8 @@ class DeliveryOrderService extends Service {
|
||||
}
|
||||
|
||||
// 准备订单数据
|
||||
const orderData = await this.prepareOrderData(deliveryOrder, info);
|
||||
const step = await this.resolveOrderStep(info, transaction);
|
||||
const orderData = await this.prepareOrderData(deliveryOrder, info, step);
|
||||
|
||||
// 创建订单
|
||||
const createdOrder = await DeliveryModel.create(orderData, { transaction });
|
||||
@ -130,11 +148,53 @@ class DeliveryOrderService extends Service {
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成订单结构哈希值
|
||||
* 直接使用itemsInfo中的items_str
|
||||
* @param {Object} itemsInfo 订单明细信息
|
||||
* @return {string} 结构哈希值
|
||||
*/
|
||||
* 根据货主仓库策略解析订单步骤。
|
||||
*
|
||||
* @param {Object} info 当前仓库与货主上下文。
|
||||
* @param {Object|null} transaction 数据库事务。
|
||||
* @return {Promise<number>} 订单步骤,需审批返回 0,免审批返回 1。
|
||||
*/
|
||||
async resolveOrderStep(info, transaction = null) {
|
||||
const { ctx } = this;
|
||||
const storeId = Number(info && info.storeId) || 0;
|
||||
const warehouseId = Number(info && info.warehouseId) || 0;
|
||||
|
||||
if (storeId <= 0 || warehouseId <= 0) {
|
||||
return DELIVERY_ORDER_STEP.PENDING_REVIEW;
|
||||
}
|
||||
|
||||
const relation = await ctx.model.StoreWarehouse.findOne({
|
||||
where: {
|
||||
store_id: storeId,
|
||||
warehouse_id: warehouseId,
|
||||
auth_status: 2,
|
||||
use_status: 1,
|
||||
},
|
||||
attributes: [ 'id' ],
|
||||
transaction,
|
||||
raw: true,
|
||||
});
|
||||
|
||||
if (!relation) {
|
||||
return DELIVERY_ORDER_STEP.PENDING_REVIEW;
|
||||
}
|
||||
|
||||
const storeWarehouseService = ctx.service && ctx.service.systems && ctx.service.systems.storeWarehouse;
|
||||
const policyConfig = storeWarehouseService && typeof storeWarehouseService.getEffectivePolicyConfigByContractId === 'function'
|
||||
? await storeWarehouseService.getEffectivePolicyConfigByContractId(relation.id, transaction)
|
||||
: null;
|
||||
|
||||
return Number(policyConfig && policyConfig.need_order_approval) === 0
|
||||
? DELIVERY_ORDER_STEP.APPROVED
|
||||
: DELIVERY_ORDER_STEP.PENDING_REVIEW;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成订单结构哈希值。
|
||||
*
|
||||
* @param {Object} itemsInfo 订单明细信息。
|
||||
* @return {string} 结构哈希值。
|
||||
*/
|
||||
generateItemsHash(itemsInfo) {
|
||||
const crypto = require('crypto');
|
||||
|
||||
@ -170,9 +230,15 @@ class DeliveryOrderService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
// 准备订单数据
|
||||
// 准备订单数据
|
||||
async prepareOrderData(deliveryOrder, info) {
|
||||
/**
|
||||
* 准备订单主表数据。
|
||||
*
|
||||
* @param {Object} deliveryOrder 订单主信息。
|
||||
* @param {Object} info 当前仓库与货主上下文。
|
||||
* @param {number} step 订单步骤。
|
||||
* @return {Promise<Object>} 可入库的订单数据。
|
||||
*/
|
||||
async prepareOrderData(deliveryOrder, info, step = DELIVERY_ORDER_STEP.PENDING_REVIEW) {
|
||||
const { ctx, service } = this;
|
||||
const {
|
||||
deliveryOrderCode,
|
||||
@ -268,6 +334,7 @@ class DeliveryOrderService extends Service {
|
||||
is_urgency: isUrgency || 'N',
|
||||
invoice_flag: invoiceFlag || 'N',
|
||||
status: 'pedding',
|
||||
step: Number.isInteger(Number(step)) ? Number(step) : DELIVERY_ORDER_STEP.PENDING_REVIEW,
|
||||
// 收件人信息
|
||||
name: receiverInfo?.name || '',
|
||||
tel: receiverInfo?.tel || '',
|
||||
@ -288,7 +355,15 @@ class DeliveryOrderService extends Service {
|
||||
};
|
||||
}
|
||||
|
||||
// 添加订单明细
|
||||
/**
|
||||
* 添加订单明细并完成库存预占。
|
||||
*
|
||||
* @param {Object|Array} orderLines 订单明细数据。
|
||||
* @param {number} orderId 订单主键。
|
||||
* @param {Object} info 当前仓库与货主上下文。
|
||||
* @param {Object} transaction 数据库事务。
|
||||
* @return {Promise<Object>} 明细创建与库存统计结果。
|
||||
*/
|
||||
async addOrderLines(orderLines, orderId, info, transaction) {
|
||||
const { ctx, app } = this;
|
||||
const { warehouseId, appKey, storeId } = info;
|
||||
@ -386,9 +461,15 @@ class DeliveryOrderService extends Service {
|
||||
}
|
||||
|
||||
if (storage.canUse < totalQtyForStock) {
|
||||
errors.push(`第${i + 1}行: 商品《${wms_stock.item_name}》库存不足,可用 ${storage.canUse},需求 ${totalQtyForStock}`);
|
||||
stockQuantityMap.set(stockId, totalQtyForStock - planQty);
|
||||
continue;
|
||||
const allowOversell = stockResult.data && stockResult.data.allow_oversell === true
|
||||
? true
|
||||
: (await ctx.service.systems.stockStore.getStoreWarehousePolicyConfigByStockId(stockId, transaction)).allowOversell;
|
||||
|
||||
if (!allowOversell) {
|
||||
errors.push(`第${i + 1}行: 商品《${wms_stock.item_name}》库存不足,可用 ${storage.canUse},需求 ${totalQtyForStock}`);
|
||||
stockQuantityMap.set(stockId, totalQtyForStock - planQty);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// 锁定库存
|
||||
|
||||
@ -17,7 +17,7 @@ class LicensePlateService extends Service {
|
||||
* 说明:优先读取独立的腾讯云公共配置,若不存在则回退到兼容的 COS 配置,
|
||||
* 以保证历史配置方式仍然可用。
|
||||
*
|
||||
* @returns {Object} 腾讯云公共配置对象
|
||||
* @return {Object} 腾讯云公共配置对象
|
||||
*/
|
||||
getTencentCloudConfig() {
|
||||
const tencentCloudConfig = this.config.tencentCloud || {};
|
||||
@ -33,7 +33,7 @@ class LicensePlateService extends Service {
|
||||
/**
|
||||
* 获取腾讯云 OCR 的默认区域。
|
||||
*
|
||||
* @returns {string} 腾讯云区域标识
|
||||
* @return {string} 腾讯云区域标识
|
||||
*/
|
||||
getTencentCloudRegion() {
|
||||
const tencentCloudConfig = this.config.tencentCloud || {};
|
||||
@ -46,7 +46,7 @@ class LicensePlateService extends Service {
|
||||
* 规范化并校验 base64 图片。
|
||||
*
|
||||
* @param {string} imageBase64 前端传入的 base64 图片
|
||||
* @returns {{ base64: string, buffer: Buffer, size: number }} 规范化后的图片信息
|
||||
* @return {{ base64: string, buffer: Buffer, size: number }} 规范化后的图片信息
|
||||
*/
|
||||
normalizeBase64Image(imageBase64) {
|
||||
const rawValue = String(imageBase64 || '').trim();
|
||||
@ -100,7 +100,7 @@ class LicensePlateService extends Service {
|
||||
* @param {string} options.version 腾讯云接口版本
|
||||
* @param {string} options.region 腾讯云区域
|
||||
* @param {Object} options.payload 请求体
|
||||
* @returns {{ requestOptions: Object, payloadString: string }} 请求配置
|
||||
* @return {{ requestOptions: Object, payloadString: string }} 请求配置
|
||||
*/
|
||||
buildTencentCloudRequest({ action, service, version, region, payload }) {
|
||||
const { secretId, secretKey } = this.getTencentCloudConfig();
|
||||
@ -163,7 +163,7 @@ class LicensePlateService extends Service {
|
||||
* @param {Object} requestConfig 请求配置
|
||||
* @param {Object} requestConfig.requestOptions https 请求参数
|
||||
* @param {string} requestConfig.payloadString 请求体字符串
|
||||
* @returns {Promise<Object>} 腾讯云响应对象
|
||||
* @return {Promise<Object>} 腾讯云响应对象
|
||||
*/
|
||||
async sendTencentCloudRequest(requestConfig) {
|
||||
const { requestOptions, payloadString } = requestConfig;
|
||||
@ -211,10 +211,10 @@ class LicensePlateService extends Service {
|
||||
* 识别车牌号码。
|
||||
*
|
||||
* @param {string} imageBase64 前端传入的 base64 图片
|
||||
* @returns {Promise<Object>} 车牌识别结果
|
||||
* @return {Promise<Object>} 车牌识别结果
|
||||
*/
|
||||
async recognizeLicensePlate(imageBase64) {
|
||||
const { base64, size } = this.normalizeBase64Image(imageBase64);
|
||||
const { base64 } = this.normalizeBase64Image(imageBase64);
|
||||
const region = this.getTencentCloudRegion();
|
||||
const requestConfig = this.buildTencentCloudRequest({
|
||||
action: OCR_ACTION,
|
||||
@ -234,7 +234,7 @@ class LicensePlateService extends Service {
|
||||
* 统一整理腾讯云车牌识别响应。
|
||||
*
|
||||
* @param {Object} response 腾讯云响应
|
||||
* @returns {Object} 归一化后的识别结果
|
||||
* @return {Object} 归一化后的识别结果
|
||||
*/
|
||||
formatLicensePlateResult(response) {
|
||||
const responseData = response && response.Response ? response.Response : response || {};
|
||||
@ -252,4 +252,4 @@ class LicensePlateService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = LicensePlateService;
|
||||
module.exports = LicensePlateService;
|
||||
|
||||
@ -248,6 +248,13 @@ class stockStoreService extends Service {
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 查询商品对应的库存记录与可用量。
|
||||
*
|
||||
* @param {number|string} itemId 商品 ID。
|
||||
* @param {Object|null} transaction 数据库事务。
|
||||
* @return {Promise<Object>} 库存查询结果。
|
||||
*/
|
||||
async getItemStorages(itemId, transaction) {
|
||||
const {
|
||||
ctx,
|
||||
@ -285,14 +292,17 @@ class stockStoreService extends Service {
|
||||
if (cached) {
|
||||
storage = cached;
|
||||
fromCache = true;
|
||||
if (storage && storage.canUse === 0) {
|
||||
app.logger.debug(`[缓存快速失败] 商品 ${itemId} 可用库存为0`);
|
||||
return {
|
||||
success: false,
|
||||
error: '库存不足',
|
||||
data: null,
|
||||
_fromCache: true,
|
||||
};
|
||||
if (storage && storage.canUse <= 0) {
|
||||
const policyConfig = await this.getStoreWarehousePolicyConfigByStockId(itemInfo.stock_id, transaction);
|
||||
if (!policyConfig.allowOversell) {
|
||||
app.logger.debug(`[缓存快速失败] 商品 ${itemId} 可用库存为0`);
|
||||
return {
|
||||
success: false,
|
||||
error: '库存不足',
|
||||
data: null,
|
||||
_fromCache: true,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -305,7 +315,7 @@ class stockStoreService extends Service {
|
||||
deleted_at: null,
|
||||
},
|
||||
attributes: [
|
||||
'id', 'quantity', 'locked_quantity', 'gross_weight',
|
||||
'id', 'store_id', 'warehouse_id', 'quantity', 'locked_quantity', 'gross_weight',
|
||||
],
|
||||
transaction,
|
||||
lock: transaction?.LOCK?.UPDATE,
|
||||
@ -315,11 +325,13 @@ class stockStoreService extends Service {
|
||||
if (stockWarehouse) {
|
||||
const quantity = parseInt(stockWarehouse.quantity) || 0;
|
||||
const lockedQuantity = parseInt(stockWarehouse.locked_quantity) || 0;
|
||||
const canUse = Math.max(0, quantity - lockedQuantity);
|
||||
const canUse = quantity - lockedQuantity;
|
||||
const grossWeight = parseInt(stockWarehouse.gross_weight) || 0;
|
||||
|
||||
storage = {
|
||||
id: stockWarehouse.id,
|
||||
storeId: Number(stockWarehouse.store_id) || 0,
|
||||
warehouseId: Number(stockWarehouse.warehouse_id) || 0,
|
||||
quantity,
|
||||
lockedQuantity,
|
||||
canUse,
|
||||
@ -354,10 +366,15 @@ class stockStoreService extends Service {
|
||||
stock: {
|
||||
id: itemInfo.id,
|
||||
stock_id: itemInfo.stock_id,
|
||||
store_id: storage && storage.storeId ? storage.storeId : undefined,
|
||||
warehouse_id: storage && storage.warehouseId ? storage.warehouseId : undefined,
|
||||
warehouse_code: itemInfo.warehouse_code,
|
||||
item_code: itemInfo.item_code,
|
||||
},
|
||||
storage,
|
||||
allow_oversell: storage && storage.canUse <= 0
|
||||
? (await this.getStoreWarehousePolicyConfigByStockId(itemInfo.stock_id, transaction)).allowOversell
|
||||
: undefined,
|
||||
},
|
||||
error: null,
|
||||
_fromCache: fromCache,
|
||||
@ -386,7 +403,7 @@ class stockStoreService extends Service {
|
||||
return 5; // 无效库存缓存5秒
|
||||
}
|
||||
|
||||
if (storage.canUse === 0) {
|
||||
if (storage.canUse <= 0) {
|
||||
return 10; // 无库存缓存10秒
|
||||
}
|
||||
|
||||
@ -439,6 +456,79 @@ class stockStoreService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取库存对应的货主-仓库签约策略配置。
|
||||
*
|
||||
* @param {number|Object} stockWarehouseId 库存 ID 或库存记录。
|
||||
* @param {Object|null} [transaction=null] 事务对象。
|
||||
* @return {Promise<Object>} 策略配置对象,包含 relation、policyConfig、allowOversell。
|
||||
*/
|
||||
async getStoreWarehousePolicyConfigByStockId(stockWarehouseId, transaction = null) {
|
||||
const { ctx } = this;
|
||||
const stockRecord = stockWarehouseId && typeof stockWarehouseId === 'object'
|
||||
? stockWarehouseId
|
||||
: await ctx.model.StockWarehouse.findOne({
|
||||
where: {
|
||||
id: Number(stockWarehouseId || 0),
|
||||
is_valid: 'Y',
|
||||
deleted_at: null,
|
||||
},
|
||||
attributes: [ 'id', 'store_id', 'warehouse_id', 'policy_config' ],
|
||||
transaction,
|
||||
raw: true,
|
||||
});
|
||||
|
||||
const storeId = Number(stockRecord && stockRecord.store_id) || 0;
|
||||
const warehouseId = Number(stockRecord && stockRecord.warehouse_id) || 0;
|
||||
|
||||
if (storeId <= 0 || warehouseId <= 0) {
|
||||
return {
|
||||
relation: null,
|
||||
policyConfig: null,
|
||||
allowOversell: false,
|
||||
};
|
||||
}
|
||||
|
||||
const relation = await ctx.model.StoreWarehouse.findOne({
|
||||
where: {
|
||||
store_id: storeId,
|
||||
warehouse_id: warehouseId,
|
||||
auth_status: 2,
|
||||
use_status: 1,
|
||||
},
|
||||
attributes: [ 'id', 'policy_config', 'auth_status', 'use_status' ],
|
||||
transaction,
|
||||
raw: true,
|
||||
});
|
||||
|
||||
if (!relation) {
|
||||
return {
|
||||
relation: null,
|
||||
policyConfig: null,
|
||||
allowOversell: false,
|
||||
};
|
||||
}
|
||||
|
||||
const storeWarehouseService = ctx.service && ctx.service.systems && ctx.service.systems.storeWarehouse;
|
||||
const policyConfig = storeWarehouseService && typeof storeWarehouseService.getEffectivePolicyConfigByContractId === 'function'
|
||||
? await storeWarehouseService.getEffectivePolicyConfigByContractId(relation.id, transaction)
|
||||
: null;
|
||||
|
||||
return {
|
||||
relation,
|
||||
policyConfig,
|
||||
allowOversell: Number(policyConfig && policyConfig.allow_oversell) === 1,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 锁定或释放库存。
|
||||
*
|
||||
* @param {number|string} stockWarehouseId 库存主键。
|
||||
* @param {number} quantity 锁定数量,负数表示释放。
|
||||
* @param {Object|null} transaction 数据库事务。
|
||||
* @return {Promise<Object>} 锁定结果。
|
||||
*/
|
||||
async lockItemStorages(stockWarehouseId, quantity, transaction) {
|
||||
const {
|
||||
ctx,
|
||||
@ -468,6 +558,7 @@ class stockStoreService extends Service {
|
||||
},
|
||||
transaction,
|
||||
lock: transaction.LOCK.UPDATE, // 行级锁
|
||||
attributes: [ 'id', 'store_id', 'warehouse_id', 'quantity', 'locked_quantity', 'gross_weight' ],
|
||||
raw: false, // 需要实例以使用方法
|
||||
});
|
||||
|
||||
@ -485,25 +576,18 @@ class stockStoreService extends Service {
|
||||
// 加锁操作:检查可用库存是否足够
|
||||
const availableQty = stockRecord.quantity - stockRecord.locked_quantity;
|
||||
if (availableQty < absQty) {
|
||||
return {
|
||||
success: false,
|
||||
error: `库存不足,可用 ${availableQty},需求 ${absQty}`,
|
||||
data: {
|
||||
available: availableQty,
|
||||
required: absQty,
|
||||
recordId: stockWarehouseId,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// 检查锁定后是否会导致超卖
|
||||
const newLocked = stockRecord.locked_quantity + absQty;
|
||||
if (newLocked > stockRecord.quantity) {
|
||||
return {
|
||||
success: false,
|
||||
error: `锁定后会导致超卖,总库存 ${stockRecord.quantity},锁定后 ${newLocked}`,
|
||||
data: null,
|
||||
};
|
||||
const policyConfig = await this.getStoreWarehousePolicyConfigByStockId(stockRecord, transaction);
|
||||
if (!policyConfig.allowOversell) {
|
||||
return {
|
||||
success: false,
|
||||
error: `库存不足,可用 ${availableQty},需求 ${absQty}`,
|
||||
data: {
|
||||
available: availableQty,
|
||||
required: absQty,
|
||||
recordId: stockWarehouseId,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 减锁操作:检查已锁定库存是否足够释放
|
||||
@ -790,8 +874,11 @@ class stockStoreService extends Service {
|
||||
const beforeQuantity = Number(storage.quantity) || 0;
|
||||
const beforeLockedQuantity = Number(storage.lockedQuantity) || 0;
|
||||
|
||||
// 关键检查:总库存是否足够
|
||||
if (beforeQuantity < outboundQty) {
|
||||
const policyConfig = await this.getStoreWarehousePolicyConfigByStockId(storage.id, currentTransaction);
|
||||
const allowOversell = policyConfig.allowOversell === true;
|
||||
|
||||
// 关键检查:总库存是否足够,启用超卖时放行负库存结果
|
||||
if (beforeQuantity < outboundQty && !allowOversell) {
|
||||
const failureResult = {
|
||||
success: false,
|
||||
error: `总库存不足,当前 ${beforeQuantity},需求 ${outboundQty}`,
|
||||
@ -826,9 +913,6 @@ class stockStoreService extends Service {
|
||||
id: storage.id,
|
||||
is_valid: 'Y',
|
||||
deleted_at: null,
|
||||
quantity: {
|
||||
[app.Sequelize.Op.gte]: outboundQty,
|
||||
},
|
||||
locked_quantity: {
|
||||
[app.Sequelize.Op.gte]: outboundQty,
|
||||
},
|
||||
|
||||
@ -1313,13 +1313,6 @@ class ReceivingService extends Service {
|
||||
};
|
||||
}
|
||||
|
||||
if (receivingDetail.receiving && receivingDetail.receiving.status !== 'receiving') {
|
||||
return {
|
||||
code: 400,
|
||||
message: '收货单状态不允许绑定或改绑商品',
|
||||
};
|
||||
}
|
||||
|
||||
const stockWarehouse = await app.model.StockWarehouse.findOne({
|
||||
where: {
|
||||
id: systemProductId,
|
||||
@ -1348,6 +1341,29 @@ class ReceivingService extends Service {
|
||||
}
|
||||
|
||||
const productStoreId = Number(stockWarehouse.store_stock?.store_id || 0);
|
||||
const receivingStoreId = Number(receivingDetail.receiving?.store_id || 0);
|
||||
|
||||
// 货主校验:收货单已有货主时,只允许绑定同一货主的商品
|
||||
if (receivingStoreId > 0 && productStoreId > 0 && receivingStoreId !== productStoreId) {
|
||||
return {
|
||||
code: 400,
|
||||
message: '该商品不属于当前收货单的货主,不允许绑定',
|
||||
};
|
||||
}
|
||||
|
||||
// 收货单无货主时,自动设置为当前商品的货主
|
||||
let autoBindStore = false;
|
||||
if (receivingStoreId <= 0 && productStoreId > 0) {
|
||||
const storeName = stockWarehouse.store_stock?.store_remask || null;
|
||||
await app.model.Receiving.update({
|
||||
store_id: productStoreId,
|
||||
store_name: storeName,
|
||||
updated_at: new Date(),
|
||||
}, {
|
||||
where: { id: receivingDetail.receiving_id, warehouse_id: warehouseId },
|
||||
});
|
||||
autoBindStore = true;
|
||||
}
|
||||
|
||||
const barcodes = Array.isArray(stockWarehouse.barcodes)
|
||||
? stockWarehouse.barcodes.map(item => item && item.barcode).filter(Boolean)
|
||||
@ -1376,6 +1392,22 @@ class ReceivingService extends Service {
|
||||
}),
|
||||
};
|
||||
|
||||
// 如果收货明细有条码且商品尚未包含该条码,则自动为商品新增条码
|
||||
const detailBarcode = String(receivingDetail.barcode || '').trim();
|
||||
if (detailBarcode && !barcodes.includes(detailBarcode)) {
|
||||
try {
|
||||
await app.model.StockBarcode.create({
|
||||
stock_id: systemProductId,
|
||||
warehouse_id: warehouseId,
|
||||
barcode: detailBarcode,
|
||||
});
|
||||
barcodes.push(detailBarcode);
|
||||
} catch (barcodeErr) {
|
||||
// 唯一索引冲突说明条码已被其他商品占用,仅记录日志不阻断业务
|
||||
ctx.logger.warn('[receiving.bindDetailProduct] 自动新增条码失败(可能已存在)', barcodeErr);
|
||||
}
|
||||
}
|
||||
|
||||
if (barcodes.length > 0) {
|
||||
updateData.barcode = barcodes.join(';');
|
||||
}
|
||||
@ -1418,15 +1450,21 @@ class ReceivingService extends Service {
|
||||
ctx.logger.warn('[receiving.bindDetailProduct] 写入操作日志失败,不影响业务', logErr);
|
||||
}
|
||||
|
||||
const responseData = {
|
||||
detail_id: detailId,
|
||||
receiving_id: receivingDetail.receiving_id,
|
||||
system_product_id: systemProductId,
|
||||
product_name: productName,
|
||||
};
|
||||
if (autoBindStore) {
|
||||
responseData.auto_bind_store_id = productStoreId;
|
||||
responseData.auto_bind_store_name = stockWarehouse.store_stock?.store_remask || null;
|
||||
}
|
||||
|
||||
return {
|
||||
code: 200,
|
||||
message: '绑定商品成功',
|
||||
data: {
|
||||
detail_id: detailId,
|
||||
receiving_id: receivingDetail.receiving_id,
|
||||
system_product_id: systemProductId,
|
||||
product_name: productName,
|
||||
},
|
||||
message: autoBindStore ? '绑定商品成功,已自动设置货主' : '绑定商品成功',
|
||||
data: responseData,
|
||||
};
|
||||
} catch (error) {
|
||||
ctx.logger.error('绑定收货单明细商品失败:', error);
|
||||
@ -2571,7 +2609,7 @@ class ReceivingService extends Service {
|
||||
const receivingNumber = String(receiving.receiving_number || receiving.id).replace(/[\\/:*?"<>|]/g, '_');
|
||||
|
||||
return await excelService.generateAndUpload({
|
||||
filename: `收货完成_${receivingNumber}.xlsx`,
|
||||
filename: `收货明细(已完成收货)_${receivingNumber}.xlsx`,
|
||||
dir: `exports/receiving/completed/${ctx.user.store_id || receiving.warehouse_id || 'common'}`,
|
||||
category: 'document',
|
||||
saveRecord: true,
|
||||
@ -2649,7 +2687,7 @@ class ReceivingService extends Service {
|
||||
`开始时间:${this.formatReportDate(receiving.created_at)}`,
|
||||
`完成时间:${this.formatReportDate(receiving.receiving_end_time)}`,
|
||||
`备注:${receiving.remark || '无'}`,
|
||||
|
||||
|
||||
].filter(Boolean).join('\n') + '。';
|
||||
|
||||
return await noticeService.send({
|
||||
|
||||
@ -385,6 +385,48 @@ class SettingStoreWarehouseService extends Service {
|
||||
await this.app.setCacheAsync(this.getPolicyConfigCacheKey(normalizedId), policyConfig, 86400 * 30);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取策略配置默认值。
|
||||
*
|
||||
* @return {Object} 策略配置默认值对象。
|
||||
*/
|
||||
getPolicyConfigDefaults() {
|
||||
return this.getPolicyConfigFieldList().reduce((result, field) => {
|
||||
result[field.key] = field.default;
|
||||
return result;
|
||||
}, {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 将策略配置与默认值合并。
|
||||
*
|
||||
* @param {*} policyConfig 已保存的策略配置。
|
||||
* @return {Object} 合并后的策略配置对象。
|
||||
*/
|
||||
mergePolicyConfigWithDefaults(policyConfig) {
|
||||
const defaults = this.getPolicyConfigDefaults();
|
||||
if (!policyConfig || typeof policyConfig !== 'object') {
|
||||
return defaults;
|
||||
}
|
||||
|
||||
return {
|
||||
...defaults,
|
||||
...policyConfig,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 按合同 ID 读取带默认值的策略配置。
|
||||
*
|
||||
* @param {number|string} contractId 合同 ID。
|
||||
* @param {Object|null} [transaction=null] 事务对象。
|
||||
* @return {Promise<Object>} 带默认值的策略配置对象。
|
||||
*/
|
||||
async getEffectivePolicyConfigByContractId(contractId, transaction = null) {
|
||||
const policyConfig = await this.loadPolicyConfigByContractId(contractId, transaction);
|
||||
return this.mergePolicyConfigWithDefaults(policyConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验当前主体是否为仓库主体。
|
||||
*
|
||||
|
||||
@ -18,7 +18,7 @@ class UploadService extends Service {
|
||||
* 说明:优先读取独立的腾讯云公共配置,若不存在则回退到兼容的 COS 配置,
|
||||
* 以保证历史配置方式仍然可用。
|
||||
*
|
||||
* @returns {Object} 腾讯云公共配置对象
|
||||
* @return {Object} 腾讯云公共配置对象
|
||||
*/
|
||||
getTencentCloudConfig() {
|
||||
const tencentCloudConfig = this.config.tencentCloud || {};
|
||||
@ -34,7 +34,7 @@ class UploadService extends Service {
|
||||
/**
|
||||
* 获取 COS 产品配置。
|
||||
*
|
||||
* @returns {Object} COS 产品配置对象
|
||||
* @return {Object} COS 产品配置对象
|
||||
*/
|
||||
getCosConfig() {
|
||||
return this.config.cos || {};
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
/*
|
||||
* @param {Egg.EggAppInfo} appInfo app info
|
||||
const path = require('node:path');
|
||||
|
||||
/**
|
||||
* 生成应用默认配置。
|
||||
* @param {Egg.EggAppInfo} appInfo 应用信息。
|
||||
* @return {Egg.EggAppConfig} 应用配置。
|
||||
*/
|
||||
module.exports = appInfo => {
|
||||
/**
|
||||
@ -65,6 +69,20 @@ module.exports = appInfo => {
|
||||
temp: '/temp/', // 临时文件目录
|
||||
},
|
||||
};
|
||||
config.fileWriter = {
|
||||
baseDir: path.join(appInfo.baseDir, 'runtime', 'file-writer'),
|
||||
maxFileSize: 100 * 1024 * 1024,
|
||||
maxConsumeRecordsPerWindow: 1000,
|
||||
maxConsumeRecordsPerRun: 1000,
|
||||
writeWindowSeconds: 1,
|
||||
maxWriteRecordsPerWindow: 1000,
|
||||
retentionDays: 7,
|
||||
cleanupIntervalMs: 60 * 60 * 1000,
|
||||
sequenceWidth: 4,
|
||||
stateMapMaxEntries: 256,
|
||||
fileExtension: '.log',
|
||||
progressExtension: '.progress',
|
||||
};
|
||||
config.fileTypes = {
|
||||
// 图片类型
|
||||
image: 'image',
|
||||
|
||||
@ -0,0 +1,81 @@
|
||||
'use strict';
|
||||
|
||||
async function getColumnType(queryInterface, tableName, columnName) {
|
||||
const [ rows ] = await queryInterface.sequelize.query(
|
||||
`
|
||||
SELECT COLUMN_TYPE
|
||||
FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = :tableName
|
||||
AND COLUMN_NAME = :columnName
|
||||
LIMIT 1
|
||||
`,
|
||||
{
|
||||
replacements: {
|
||||
tableName,
|
||||
columnName,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
return String(rows[0]?.COLUMN_TYPE || '').toLowerCase();
|
||||
}
|
||||
|
||||
async function changeSignedQuantityColumns(queryInterface, Sequelize, direction) {
|
||||
const tableName = 'wms_stock_warehouse';
|
||||
const quantityType = direction === 'up'
|
||||
? Sequelize.INTEGER(11)
|
||||
: Sequelize.INTEGER(11).UNSIGNED;
|
||||
|
||||
const lockedQuantityType = direction === 'up'
|
||||
? Sequelize.INTEGER(11)
|
||||
: Sequelize.INTEGER(11).UNSIGNED;
|
||||
|
||||
const quantityColumnType = await getColumnType(queryInterface, tableName, 'quantity').catch(() => '');
|
||||
if (direction === 'up' && quantityColumnType.includes('unsigned')) {
|
||||
await queryInterface.changeColumn(tableName, 'quantity', {
|
||||
type: quantityType,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: '库存数量',
|
||||
});
|
||||
}
|
||||
|
||||
const lockedColumnType = await getColumnType(queryInterface, tableName, 'locked_quantity').catch(() => '');
|
||||
if (direction === 'up' && lockedColumnType.includes('unsigned')) {
|
||||
await queryInterface.changeColumn(tableName, 'locked_quantity', {
|
||||
type: lockedQuantityType,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: '锁定数量',
|
||||
});
|
||||
}
|
||||
|
||||
if (direction === 'down' && !quantityColumnType.includes('unsigned')) {
|
||||
await queryInterface.changeColumn(tableName, 'quantity', {
|
||||
type: quantityType,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: '库存数量',
|
||||
});
|
||||
}
|
||||
|
||||
if (direction === 'down' && !lockedColumnType.includes('unsigned')) {
|
||||
await queryInterface.changeColumn(tableName, 'locked_quantity', {
|
||||
type: lockedQuantityType,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: '锁定数量',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
async up(queryInterface, Sequelize) {
|
||||
await changeSignedQuantityColumns(queryInterface, Sequelize, 'up');
|
||||
},
|
||||
|
||||
async down(queryInterface, Sequelize) {
|
||||
await changeSignedQuantityColumns(queryInterface, Sequelize, 'down');
|
||||
},
|
||||
};
|
||||
@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
async up(queryInterface) {
|
||||
const [ columns ] = await queryInterface.sequelize.query('SHOW COLUMNS FROM `wms_qimen_log` LIKE \'log_id\'');
|
||||
if (columns.length > 0) {
|
||||
const [ idxs ] = await queryInterface.sequelize.query('SHOW INDEX FROM `wms_qimen_log` WHERE Key_name = \'idx_log_id\'');
|
||||
if (idxs.length === 0) {
|
||||
await queryInterface.sequelize.query('ALTER TABLE `wms_qimen_log` ADD UNIQUE INDEX `idx_log_id` (`log_id`)');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
await queryInterface.sequelize.query('ALTER TABLE `wms_qimen_log` ADD COLUMN `log_id` VARCHAR(32) DEFAULT NULL AFTER `id`');
|
||||
const [ idxs2 ] = await queryInterface.sequelize.query('SHOW INDEX FROM `wms_qimen_log` WHERE Key_name = \'idx_log_id\'');
|
||||
if (idxs2.length === 0) {
|
||||
await queryInterface.sequelize.query('ALTER TABLE `wms_qimen_log` ADD UNIQUE INDEX `idx_log_id` (`log_id`)');
|
||||
}
|
||||
},
|
||||
|
||||
async down(queryInterface) {
|
||||
const [ indexes ] = await queryInterface.sequelize.query('SHOW INDEX FROM `wms_qimen_log` WHERE Key_name = \'idx_log_id\'');
|
||||
if (indexes.length > 0) {
|
||||
await queryInterface.sequelize.query('ALTER TABLE `wms_qimen_log` DROP INDEX `idx_log_id`');
|
||||
}
|
||||
|
||||
const [ columns ] = await queryInterface.sequelize.query('SHOW COLUMNS FROM `wms_qimen_log` LIKE \'log_id\'');
|
||||
if (columns.length > 0) {
|
||||
await queryInterface.sequelize.query('ALTER TABLE `wms_qimen_log` DROP COLUMN `log_id`');
|
||||
}
|
||||
},
|
||||
};
|
||||
@ -0,0 +1,88 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* 为发货单主表及分表新增 audit_status 字段。
|
||||
* 若存在 inspection_status,则将 audit_status 放在其后;否则按默认位置新增,保证兼容旧库结构。
|
||||
* @param {import('sequelize').QueryInterface} queryInterface Sequelize 查询接口
|
||||
* @returns {Promise<void>} 无返回值
|
||||
*/
|
||||
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 = 'audit_status'
|
||||
`,
|
||||
{ replacements: { tableName } }
|
||||
);
|
||||
|
||||
if (columns.length === 0) {
|
||||
const [ inspectionColumns ] = await queryInterface.sequelize.query(
|
||||
`
|
||||
SELECT COLUMN_NAME
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = :tableName
|
||||
AND COLUMN_NAME = 'inspection_status'
|
||||
`,
|
||||
{ replacements: { tableName } }
|
||||
);
|
||||
|
||||
const alterSql = inspectionColumns.length > 0
|
||||
? `ALTER TABLE \`${tableName}\` ADD COLUMN \`audit_status\` enum('pending','approved','rejected') DEFAULT 'pending' COMMENT '审批状态' AFTER \`inspection_status\``
|
||||
: `ALTER TABLE \`${tableName}\` ADD COLUMN \`audit_status\` enum('pending','approved','rejected') DEFAULT 'pending' COMMENT '审批状态'`;
|
||||
|
||||
await queryInterface.sequelize.query(alterSql);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 回滚删除发货单主表及分表的 audit_status 字段。
|
||||
* 仅在字段存在时删除,保证回滚幂等且安全。
|
||||
* @param {import('sequelize').QueryInterface} queryInterface Sequelize 查询接口
|
||||
* @returns {Promise<void>} 无返回值
|
||||
*/
|
||||
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 = 'audit_status'
|
||||
`,
|
||||
{ replacements: { tableName } }
|
||||
);
|
||||
|
||||
if (columns.length > 0) {
|
||||
await queryInterface.sequelize.query(
|
||||
`ALTER TABLE \`${tableName}\` DROP COLUMN \`audit_status\``
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
@ -0,0 +1,122 @@
|
||||
'use strict';
|
||||
|
||||
const STEP_COMMENT = '订单步骤:0未审核,1已审核,2处理中,3驳回/异常,4配送中,5已完成,9已关闭';
|
||||
const AUDIT_STATUS_COMMENT = '审批状态';
|
||||
|
||||
/**
|
||||
* 判断数据表是否存在指定字段。
|
||||
*
|
||||
* @param {import('sequelize').QueryInterface} queryInterface Sequelize 查询接口。
|
||||
* @param {string} tableName 数据表名。
|
||||
* @param {string} columnName 字段名。
|
||||
* @return {Promise<boolean>} 是否存在。
|
||||
*/
|
||||
async function hasColumn(queryInterface, tableName, columnName) {
|
||||
const [ columns ] = await queryInterface.sequelize.query(
|
||||
`
|
||||
SELECT COLUMN_NAME
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = :tableName
|
||||
AND COLUMN_NAME = :columnName
|
||||
`,
|
||||
{ replacements: { tableName, columnName } }
|
||||
);
|
||||
|
||||
return columns.length > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找发货单主表及分表。
|
||||
*
|
||||
* @param {import('sequelize').QueryInterface} queryInterface Sequelize 查询接口。
|
||||
* @return {Promise<string[]>} 表名列表。
|
||||
*/
|
||||
async function findOrderDeliveryTables(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\\_%')
|
||||
`);
|
||||
|
||||
return tables.map(row => row.TABLE_NAME);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* 为发货单主表及分表新增 step 字段,并从 audit_status 回填后删除 audit_status。
|
||||
*
|
||||
* @param {import('sequelize').QueryInterface} queryInterface Sequelize 查询接口。
|
||||
* @returns {Promise<void>} 无返回值。
|
||||
*/
|
||||
async up(queryInterface) {
|
||||
const tables = await findOrderDeliveryTables(queryInterface);
|
||||
|
||||
for (const tableName of tables) {
|
||||
const hasStep = await hasColumn(queryInterface, tableName, 'step');
|
||||
const hasAuditStatus = await hasColumn(queryInterface, tableName, 'audit_status');
|
||||
|
||||
if (!hasStep) {
|
||||
const hasInspectionStatus = await hasColumn(queryInterface, tableName, 'inspection_status');
|
||||
const addStepSql = hasInspectionStatus
|
||||
? `ALTER TABLE \`${tableName}\` ADD COLUMN \`step\` int(10) NOT NULL DEFAULT 0 COMMENT '${STEP_COMMENT}' AFTER \`inspection_status\``
|
||||
: `ALTER TABLE \`${tableName}\` ADD COLUMN \`step\` int(10) NOT NULL DEFAULT 0 COMMENT '${STEP_COMMENT}'`;
|
||||
await queryInterface.sequelize.query(addStepSql);
|
||||
}
|
||||
|
||||
if (hasAuditStatus) {
|
||||
await queryInterface.sequelize.query(`
|
||||
UPDATE \`${tableName}\`
|
||||
SET \`step\` = CASE \`audit_status\`
|
||||
WHEN 'approved' THEN 1
|
||||
WHEN 'rejected' THEN 3
|
||||
ELSE 0
|
||||
END
|
||||
`);
|
||||
|
||||
await queryInterface.sequelize.query(
|
||||
`ALTER TABLE \`${tableName}\` DROP COLUMN \`audit_status\``
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 回滚恢复 audit_status 字段,并根据 step 回填后删除 step。
|
||||
*
|
||||
* @param {import('sequelize').QueryInterface} queryInterface Sequelize 查询接口。
|
||||
* @returns {Promise<void>} 无返回值。
|
||||
*/
|
||||
async down(queryInterface) {
|
||||
const tables = await findOrderDeliveryTables(queryInterface);
|
||||
|
||||
for (const tableName of tables) {
|
||||
const hasStep = await hasColumn(queryInterface, tableName, 'step');
|
||||
const hasAuditStatus = await hasColumn(queryInterface, tableName, 'audit_status');
|
||||
|
||||
if (!hasAuditStatus) {
|
||||
const hasInspectionStatus = await hasColumn(queryInterface, tableName, 'inspection_status');
|
||||
const addAuditStatusSql = hasInspectionStatus
|
||||
? `ALTER TABLE \`${tableName}\` ADD COLUMN \`audit_status\` enum('pending','approved','rejected') DEFAULT 'pending' COMMENT '${AUDIT_STATUS_COMMENT}' AFTER \`inspection_status\``
|
||||
: `ALTER TABLE \`${tableName}\` ADD COLUMN \`audit_status\` enum('pending','approved','rejected') DEFAULT 'pending' COMMENT '${AUDIT_STATUS_COMMENT}'`;
|
||||
await queryInterface.sequelize.query(addAuditStatusSql);
|
||||
}
|
||||
|
||||
if (hasStep) {
|
||||
await queryInterface.sequelize.query(`
|
||||
UPDATE \`${tableName}\`
|
||||
SET \`audit_status\` = CASE
|
||||
WHEN \`step\` = 1 THEN 'approved'
|
||||
WHEN \`step\` = 3 THEN 'rejected'
|
||||
ELSE 'pending'
|
||||
END
|
||||
`);
|
||||
|
||||
await queryInterface.sequelize.query(
|
||||
`ALTER TABLE \`${tableName}\` DROP COLUMN \`step\``
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
119
docs/file-writer.md
Normal file
119
docs/file-writer.md
Normal file
@ -0,0 +1,119 @@
|
||||
# 本地文件队列(app.fileWriter)
|
||||
|
||||
本文档说明仓库中提供的本地文件队列写入能力(实现文件:app/lib/file_writer.js),用于把业务数据按 JSON Lines 追加到本地文件并由消费者按需读取处理,适合低延迟、本地持久化、批处理/异步消费场景。
|
||||
|
||||
**实现要点(写入特性)**
|
||||
- 串行写入:同一进程内通过内部队列 `enqueue` 串行化写入,保证单进程内顺序性。
|
||||
- 强制落盘:每次写入使用文件句柄写入并调用 `handle.sync()` 进行 fsync,尽量保证数据落盘。
|
||||
- 自动轮转:当当前文件大小 + 待写入字节数 超过 `maxFileSize` 时,会自增序号并切换到新文件(sequence)。
|
||||
- 目录结构:默认 baseDir 下按业务与日期分区:
|
||||
- baseDir/<businessSegment>/<YYYY>/<MM>/<DD>/
|
||||
- 文件命名:文件前缀包含业务段与进程标识(`<business>-<machine>-<worker>-p<pid>-<seq>`),尾部带序号与扩展名(`fileExtension`,默认 `.log`)。
|
||||
- 进度(.progress)断点续传:每个消费者使用独立的隐藏进度文件(以 `.<consumerName>.progress` 命名),写入采用临时文件+rename 的原子替换策略,消费端可通过进度恢复消费位置。
|
||||
- Worker/进程隔离:写入文件名包含 `machineId`、`workerId` 与 `pid`,不同进程不会写入同一文件,避免互相竞争。
|
||||
- 清理策略:基于 `retentionDays` 定期删除过期的数据文件与进度文件。
|
||||
|
||||
**目录与文件示例**
|
||||
- 目录:`/path/to/runtime/file-writer/orders/2026/04/09/`
|
||||
- 数据文件示例:`orders-myhost-worker1-p1234-0001.log`
|
||||
- 进度文件示例:`.consumer-1.progress`(位于同一分区目录下)
|
||||
|
||||
**配置项说明(config.fileWriter)**
|
||||
- `baseDir`:基础目录,默认 `path.join(app.baseDir, 'runtime', 'file-writer')`。
|
||||
- `maxFileSize`:单文件最大字节数,超过后轮转。支持数字(字节)或带单位字符串(如 `100M`、`1G`)。默认 `100 * 1024 * 1024`(100MB)。
|
||||
- `retentionDays`:保留天数,超过则删除。设为 `0` 或负值可禁用清理。默认 `7`。
|
||||
- `cleanupIntervalMs`:触发清理的最小间隔(毫秒),写入时会基于此决定是否执行清理,设置为 `0` 或负值可禁用定期清理。默认 `3600000`(1 小时)。
|
||||
- `sequenceWidth`:文件序号宽度(零填充),默认 `4`(例如 `0001`)。
|
||||
- `fileExtension`:数据文件扩展名,默认 `.log`。
|
||||
- `progressExtension`:进度文件扩展名,默认 `.progress`。
|
||||
- `machineId`、`workerId`(可选):可通过配置覆盖,默认使用主机名与 `process.env.EGG_WORKER_ID`。
|
||||
|
||||
默认配置位置:`config/config.default.js` 的 `config.fileWriter` 节点。
|
||||
|
||||
示例(可放入 `config/config.local.js` 覆盖默认):
|
||||
|
||||
```js
|
||||
const path = require('path');
|
||||
|
||||
exports.fileWriter = {
|
||||
baseDir: path.join(__dirname, '..', 'runtime', 'file-writer'),
|
||||
maxFileSize: '200M',
|
||||
retentionDays: 14,
|
||||
cleanupIntervalMs: 60 * 60 * 1000,
|
||||
sequenceWidth: 4,
|
||||
fileExtension: '.log',
|
||||
progressExtension: '.progress',
|
||||
// machineId: 'my-host',
|
||||
// workerId: 'worker-1',
|
||||
};
|
||||
```
|
||||
|
||||
**写入示例(业务侧)**
|
||||
简单写入(在任何可以访问 `app` 的位置):
|
||||
|
||||
```js
|
||||
// 在 controller/service 中
|
||||
await app.fileWriter.write('orders', { id: 123, event: 'created', payload: { /* ... */ } });
|
||||
// 返回对象包含 filePath、sequence、bytesWritten 等信息
|
||||
```
|
||||
|
||||
**消费/读取示例(推荐使用 app.fileWriter 提供的 API)**
|
||||
推荐使用 `getProgressFilePath` + `consumeFiles` 提供的断点续传能力:
|
||||
|
||||
```js
|
||||
// 示例:定期或守护进程式消费 orders
|
||||
async function consumeOrders(app) {
|
||||
const writer = app.fileWriter;
|
||||
const progressFile = writer.getProgressFilePath('orders', new Date(), 'order-consumer-1');
|
||||
|
||||
const result = await writer.consumeFiles({
|
||||
businessName: 'orders',
|
||||
progressFilePath: progressFile,
|
||||
onRecord: async (record, meta) => {
|
||||
// record: 解析后的对象
|
||||
// meta: { filePath, offset, index }
|
||||
// 在这里实现消息处理逻辑(去重、入库、调用外部服务等)
|
||||
},
|
||||
parseJson: true,
|
||||
});
|
||||
|
||||
return result; // 包含 processedCount 与最新 progress
|
||||
}
|
||||
```
|
||||
|
||||
如需逐文件手动控制消费,也可使用 `readRecords`:
|
||||
|
||||
```js
|
||||
const res = await app.fileWriter.readRecords(filePath, { startOffset: 0 });
|
||||
for (const rec of res.records) {
|
||||
// 处理 rec
|
||||
}
|
||||
// 手动保存进度
|
||||
await app.fileWriter.saveProgress(progressFilePath, {
|
||||
filePath,
|
||||
offset: res.nextOffset,
|
||||
processedCount: (previousCount || 0) + res.records.length,
|
||||
});
|
||||
```
|
||||
|
||||
**进度文件(.progress)格式**
|
||||
- 保存为 JSON,包含至少字段:`filePath`、`offset`、`processedCount`、`updatedAt`。
|
||||
- 写入采用临时文件写入 + `fsync` + `rename` 的方式尽量保证原子性。
|
||||
|
||||
**注意事项 / 运行时建议**
|
||||
- 不要通过静态文件服务或外部 URL 直接暴露 `baseDir`(例如 `runtime/`),避免被外部下载或篡改。
|
||||
- 多 Worker / 多机部署:
|
||||
- 默认每个进程生成独立的数据文件(文件名包含 `machineId`、`workerId`、`pid`),不会有多个进程同时写入同一文件。若你的设计需要跨进程全局严格顺序,请在上游统一入口合并写入或使用集中式队列(如 Kafka/Redis)。
|
||||
- 消费者可以按进程拆分(针对单进程的文件)或由独立中心消费者按文件目录遍历处理。
|
||||
- 可通过配置显式设置 `machineId`/`workerId` 来标识不同实例。
|
||||
- 关闭或调整清理策略:若需长期保留数据,请将 `retentionDays` 设为合适值或禁用清理(`0` 或负值)。
|
||||
- 性能角度:每次写入触发 fsync 会有性能开销,适合需要高可靠性的场景;若对持久性要求不高,可考虑将写入逻辑改为批量 fsync(此处为实现约束,不建议直接修改核心行为)。
|
||||
|
||||
---
|
||||
|
||||
如果希望在项目首页或工具箱中添加跳转链接,建议把一行链接加入到 [README.md](README.md) 或 [AI_TOOLBOX.md](AI_TOOLBOX.md) 的相关位置,指向本文件 `docs/file-writer.md`。
|
||||
|
||||
----
|
||||
**参考实现位置**
|
||||
- 代码实现:app/lib/file_writer.js
|
||||
- 默认配置:config/config.default.js -> `config.fileWriter`
|
||||
@ -2,7 +2,7 @@
|
||||
{
|
||||
"version": "2026.04.07-system-01",
|
||||
"date": "2026-04-07",
|
||||
"summary": "修正 warehouse.getAreaRacks 的鉴权/权限链路文档,明确该接口需要登录并走权限校验。",
|
||||
"summary": "修正 warehouse.getAreaRacks 的鉴权/权限链路文档,明确该接口需要 登录并走权限校验。",
|
||||
"methods": [
|
||||
"warehouse.getAreaRacks"
|
||||
],
|
||||
@ -11,308 +11,434 @@
|
||||
"用于补充该接口权限链路修正文档的历史上下文,不改变 methods/system.json 的 SSOT 角色。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "2026.04.07-system-02",
|
||||
"date": "2026-04-07",
|
||||
"summary": "补充签约配置相关接口文档,覆盖策略字段元信息查询与面单数量人工调整。",
|
||||
"methods": [
|
||||
"storeWarehouse.store.getPolicyConfigFields",
|
||||
"storeWarehouse.store.adjustPrintQuantity"
|
||||
],
|
||||
"notes": [
|
||||
"getPolicyConfigFields 说明为获取签约策略可配置字段元信息列表。",
|
||||
"adjustPrintQuantity 说明为人工调整签约关系下的面单余额并记录变更日志,并明确 id、change_quantity、reason 等关键入参。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "2026.04.07-system-03",
|
||||
"date": "2026-04-07",
|
||||
"summary": "对外命名从 qimenConfig 收口为 apiConfig,并在接口配置文档中强调 interface_type_id 校验。",
|
||||
"methods": [
|
||||
"storeWarehouse.store.listApiConfig",
|
||||
"storeWarehouse.store.saveApiConfig",
|
||||
"storeWarehouse.store.deleteQimenConfig"
|
||||
],
|
||||
"notes": [
|
||||
"文档对外统一使用 apiConfig / api_config 命名,减少 qimenConfig 历史别名歧义。",
|
||||
"saveApiConfig 要求 interface_type_id 为必填且必须指向已存在的 wms_interface_type 记录。",
|
||||
"listApiConfig / deleteQimenConfig 同步补充 interface_type_id 字段说明。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "2026.04.07-system-04",
|
||||
"date": "2026-04-07",
|
||||
"summary": "补充 /api/docs 文档体验增强说明,新增查看变更记录与查看原文 JSON 的入口说明。",
|
||||
"methods": [
|
||||
"/api/docs",
|
||||
"/api/docs/:docName",
|
||||
"/api/docs/:docName/raw",
|
||||
"/api/docs/:docName/changes"
|
||||
],
|
||||
"notes": [
|
||||
"sidecar 变更数组用于承载文档历史说明,不替代 methods/system.json 作为 SSOT。",
|
||||
"原文 JSON 入口继续用于直接查看当前生效文档。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "2026.04.07-system-05",
|
||||
"date": "2026-04-07",
|
||||
"summary": "修正 storeWarehouse.store.adjustPrintQuantity 的面单余额调整语义:由增减/累加改为覆盖设置目标余额。",
|
||||
"methods": [
|
||||
"storeWarehouse.store.adjustPrintQuantity"
|
||||
],
|
||||
"notes": [
|
||||
"adjustPrintQuantity 当前兼容 print_quantity、target_quantity、change_quantity、adjust_quantity 作为目标面单余额输入,不再按增减量解释。",
|
||||
"变更日志中的 change_quantity 由 before/after 自动计算差值,以兼容历史审计与展示。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "2026.04.07-system-06",
|
||||
"date": "2026-04-07",
|
||||
"method": "storeWarehouse.store.saveApiConfig",
|
||||
"type": "changed",
|
||||
"summary": "按接口类型分类限制必填字段,OPEN_API 创建时自动生成 self_app_key/self_app_secret",
|
||||
"detail": "QM_WMS 类型须填写 qimen_app_key/qimen_customer_id/qimen_warehouse_code;OPEN_API 类型三个奇门字段非必填,创建时自动生成 self_app_key(WMS+32位HEX)和 self_app_secret(64位HEX),更新时保留已有密钥。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.07-system-07",
|
||||
"date": "2026-04-07",
|
||||
"method": "index.listInterfaceTypes",
|
||||
"type": "added",
|
||||
"summary": "新增接口类型列表查询接口,归属基础模块,无需权限",
|
||||
"detail": "返回所有已启用的接口类型(wms_interface_type),包含 id、interface_code、interface_name、interface_category、description 字段。设置 isNeedAuth: false, isNeedLogin: true。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.07-system-08",
|
||||
"date": "2026-04-07",
|
||||
"method": "storeWarehouse.store.saveApiConfig",
|
||||
"type": "changed",
|
||||
"summary": "app_name 改为必传参数",
|
||||
"detail": "app_name 不再有默认值自动生成逻辑,调用方必须传入非空的 app_name,否则返回 400 错误。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.07-system-09",
|
||||
"date": "2026-04-07",
|
||||
"method": "storage.inventory.quickPutaway",
|
||||
"type": "added",
|
||||
"summary": "新增收货单快捷入库上架接口",
|
||||
"detail": "新建 storage.inventory 库存操作模块。quickPutaway 从收货单直接生成入库单(SCRK)并写入 wms_storage 库存表,同时更新 wms_stock_warehouse 库存数量(悲观行锁),回填收货明细入库状态。要求收货单已完成且所有明细已匹配系统商品。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.08-system-01",
|
||||
"date": "2026-04-08",
|
||||
"method": "storage.inventory.matchPutaway",
|
||||
"type": "added",
|
||||
"summary": "新增收货单与入库单匹配入库接口",
|
||||
"detail": "接收多个收货单和入库单,按商品(stock_warehouse_id)进行数量匹配入库,完成后根据入库单来源(QM/API)自动触发回传。入参为 receiving_ids(数组)和 entry_order_ids(数组),返回匹配汇总、各收货单入库状态、各入库单状态及回传结果。isNeedAuth=true, isNeedLogin=true, isNeedRight=false。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.08-system-02",
|
||||
"date": "2026-04-08",
|
||||
"method": "storeWarehouse.store.saveApiConfig",
|
||||
"type": "changed",
|
||||
"summary": "saveApiConfig 新增 callback_url 可选参数",
|
||||
"detail": "新增 callback_url 参数(VARCHAR(500),可选),用于 OPEN_API 类型入库单的回调地址配置。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.08-system-03",
|
||||
"date": "2026-04-08",
|
||||
"method": "storeWarehouse.store.list, storeWarehouse.store.listApiConfig",
|
||||
"type": "changed",
|
||||
"summary": "serializeQimenConfig 新增返回 callback_url 字段,影响 list 和 listApiConfig 两个接口",
|
||||
"detail": "serializeQimenConfig() 序列化方法新增 callback_url(string)字段。storeWarehouse.store.list 返回的每条记录 api_config 对象中包含 callback_url;storeWarehouse.store.listApiConfig 返回的 list 数组中每条配置包含 callback_url。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.08-system-04",
|
||||
"date": "2026-04-08",
|
||||
"method": "storage.inventory.transferLocation",
|
||||
"type": "added",
|
||||
"summary": "新增库存移库(库位转移)接口",
|
||||
"detail": "新增 storage.inventory.transferLocation 接口,支持批量多商品多库位移库,包含部分数量移库与全量移库。入参为 warehouse_id(仓库ID)和 transfers 数组(storage_id、target_space_id、quantity),触发 storage_transfer_completed 通知事件,每条移库记录独立操作日志。isNeedAuth=true, isNeedLogin=true。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.08-system-05",
|
||||
"date": "2026-04-08",
|
||||
"method": "storage.inventory.transferLocation",
|
||||
"type": "modified",
|
||||
"summary": "简化移库接口入参,从批量 transfers 数组改为单条移库",
|
||||
"detail": "移除 warehouse_id 和 transfers 数组入参,改为扁平的 storage_id + target_space_id + quantity 三个顶层参数。warehouse_id 从库存记录自动获取,接口从批量移库简化为单商品单库位移库。响应结构同步简化为单条结果对象。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.08-system-06",
|
||||
"date": "2026-04-08",
|
||||
"method": "stock.warehouse.getStockDetail",
|
||||
"type": "added",
|
||||
"summary": "新增商品库存明细查询接口",
|
||||
"detail": "新增 stock.warehouse.getStockDetail 接口,按库位/批次维度查询商品库存分布。入参为 stock_id(必填,商品库存ID)和 pagination(可选,含 page/pageSize)。返回 stockItem(商品概要)、storageList(wms_storage 明细数组,含批次号、库位、数量、锁定数量、生产日期、过期日期等,关联 location_space 库位信息)、pagination 分页信息。isNeedAuth=false, isNeedLogin=true。底层调用 stockStore.getStockDetail,自动校验商品归属当前仓库。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.08-system-07",
|
||||
"date": "2026-04-08",
|
||||
"method": "stock.warehouse.getStockDetail",
|
||||
"type": "modified",
|
||||
"summary": "新增入参 group_by_batch,支持按批次维度切换库存明细聚合方式",
|
||||
"detail": "新增可选布尔参数 group_by_batch(默认 false)。false 时按库位合并数量,批次相关字段(batch_no, production_date, expiry_date, inbound_time, inbound_order_no, supplier_batch_no)置 null;true 时保持原逻辑返回每条明细。出参结构不变,但 storageList 中批次字段在合并模式下为 null。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.08-system-08",
|
||||
"date": "2026-04-08",
|
||||
"method": "storage.inventory.transferByProduct",
|
||||
"type": "added",
|
||||
"summary": "新增按商品维度移库接口",
|
||||
"detail": "新增 storage.inventory.transferByProduct 接口,按库位+商品查找所有库存记录合并移动。入参为 space_id(原库位ID)、stock_id(商品SKU ID,即 wms_stock_warehouse.id)、target_space_id(目标库位ID)、quantity(移库数量)。开启批次管理(is_batch_mgmt=Y)的商品会被拒绝,需使用 transferLocation 按库存记录精确移库。复用 storage_transfer_completed 通知事件,操作日志编码 STORAGE_TRANSFER_BY_PRODUCT。isNeedAuth=true, isNeedLogin=true。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.08-system-09",
|
||||
"date": "2026-04-08",
|
||||
"method": "storeWarehouse.store.list",
|
||||
"type": "updated",
|
||||
"summary": "补充 storeWarehouse.store.list 完整 response 输出字段说明,移除 api_config / apiConfig",
|
||||
"detail": "从返回结果中移除 api_config 和 apiConfig 字段(代码中 delete serialized.api_config / delete serialized.apiConfig),文档 response 补充完整输出字段列表:id, store_id, store_name, warehouse_id, warehouse_name, counterparty_id, counterparty_name, current_subject_role, auth_status, auth_status_label, apply_reason, review_comment, apply_time, review_time, auth_start, auth_end, actual_end, print_quantity, applied_by, reviewed_by, ended_by, remask, use_status, policy_config, is_auth_valid, remaining_days 以及分页和 current_subject 信息。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.08-system-10",
|
||||
"date": "2026-04-08",
|
||||
"method": "storeWarehouse.store.list",
|
||||
"type": "changed",
|
||||
"summary": "货主列表返回新增 has_qimen_config 布尔字段",
|
||||
"detail": "storeWarehouse.store.list 返回的 data.list[] 中新增 has_qimen_config(boolean),表示该货主是否已配置奇门。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.08-system-11",
|
||||
"date": "2026-04-08",
|
||||
"method": "stock.warehouse.search",
|
||||
"type": "updated",
|
||||
"summary": "补全 stock.warehouse.search 接口文档,新增 params / response / errors 完整说明",
|
||||
"detail": "入参补充 keyword(string,模糊匹配 item_code / item_name / goods_code / barcode)和 store_id(number,按货主筛选)。响应补充 data 数组各字段(id, item_code, goods_code, item_name, sku_property, stock_unit, quantity, locked_quantity, brand_name, item_type, barcodes, store_stock)以及 total。errors 补充 code=0 搜索失败场景。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.08-system-12",
|
||||
"date": "2026-04-08",
|
||||
"method": "stock.warehouse.search",
|
||||
"type": "updated",
|
||||
"summary": "新增 with_stock / is_batch 参数,支持返回关联库存明细(按库位分组或按批次逐条)",
|
||||
"detail": "入参新增 with_stock(boolean,默认 false,是否返回关联库存数据)和 is_batch(boolean,默认 false,仅 with_stock=true 时生效,按批次明细返回)。响应 data[] 新增 storage[] 字段:is_batch=false 时按库位分组汇总(含 space_id、space、inventory_type、quantity、locked_quantity、available_quantity);is_batch=true 时逐条返回批次明细(含 id、stock_id、space_id、batch_no、inventory_type、quantity、locked_quantity、available_quantity、production_date、expiry_date、inbound_time、inbound_order_no、supplier_batch_no、created_at、space)。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.08-system-13",
|
||||
"date": "2026-04-08",
|
||||
"method": "wms_stock_transaction",
|
||||
"type": "added",
|
||||
"summary": "新增 wms_stock_transaction 表和模型",
|
||||
"detail": "新增出入库流水记录表 wms_stock_transaction,含 transaction_type(INBOUND/OUTBOUND)、warehouse_id、store_id、stock_id、storage_id、space_id、quantity、batch_no、inventory_type、order_type、order_no、order_id、receiving_id、entry_order_id、operator_id、operator_name、remark 等字段,关联 StockWarehouse 和 Storage 模型。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.08-system-14",
|
||||
"date": "2026-04-08",
|
||||
"method": "storage.inventory.quickPutaway,storage.inventory.matchPutaway",
|
||||
"type": "updated",
|
||||
"summary": "quickPutaway 和 matchPutaway 入库时自动写入出入库记录",
|
||||
"detail": "入库操作完成后自动写入 wms_stock_transaction 记录。quickPutaway 写入 order_type='SCRK'(收货入库),matchPutaway 写入 order_type='MATCH'(匹配入库),均自动填充 warehouse_id、store_id、stock_id、storage_id、space_id、quantity、batch_no、inventory_type 等字段。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.08-system-15",
|
||||
"date": "2026-04-08",
|
||||
"method": "storage.inventory.list",
|
||||
"type": "added",
|
||||
"summary": "新增 storage.inventory.list 出入库记录列表查询接口",
|
||||
"detail": "出入库记录列表查询,支持 where 条件(transaction_type、stock_id、space_id、store_id、order_type、order_no、inventory_type、operator_name、created_at)、分页(pagination)、排序(sort)和 group_by_batch 参数。默认合并模式按库位+商品聚合返回合计数量与记录条数,group_by_batch=true 时返回每条明细含 batch_no、order_no、operator_name 等完整信息。响应均关联 stockItem(item_code、item_name、sku_property、stock_unit)。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.08-system-16",
|
||||
"date": "2026-04-08",
|
||||
"module": "storage",
|
||||
"method": "storage.transaction.list",
|
||||
"type": "rename",
|
||||
"summary": "出入库流水记录查询接口从 storage.inventory.list 改名为 storage.transaction.list",
|
||||
"detail": "将出入库流水记录查询从 storage.inventory.list 迁移到 storage.transaction.list,避免与库存列表概念混淆。功能和参数不变。isNeedAuth=false, isNeedLogin=true, isNeedRight=false。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.08-system-17",
|
||||
"date": "2026-04-08",
|
||||
"module": "storage",
|
||||
"method": "storage.inventory.list",
|
||||
"type": "add",
|
||||
"summary": "新增 storage.inventory.list 库存列表查询接口",
|
||||
"detail": "新增库存列表查询接口,查询 wms_storage 表。支持 where 条件(stock_id/space_id/store_id/inventory_type/batch_no/inbound_order_no/available_quantity/inbound_time/created_at)、分页、排序。支持 group_by_batch 参数:默认 false 按库位+商品合并(SUM quantity/locked_quantity/available_quantity),true 返回每条明细含 batch_no/production_date/expiry_date 等。关联 stockItem(商品信息)和 space(库位信息)。isNeedAuth=false, isNeedLogin=true, isNeedRight=false。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.08-system-18",
|
||||
"date": "2026-04-08",
|
||||
"module": "storage",
|
||||
"method": "storage.entry.create",
|
||||
"type": "remove",
|
||||
"summary": "移除 storage.entry.create 创建入库单接口",
|
||||
"detail": "不再允许通过 API 创建入库单。入库单仅由快捷入库(quickPutaway)和匹配入库(matchPutaway)等内部流程自动创建。底层 service 实现保留但不再通过 systemMethods 暴露。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.08-system-19",
|
||||
"date": "2026-04-08",
|
||||
"module": "storage",
|
||||
"method": "storage.entry.addDetail, storage.entry.deleteDetail, storage.entry.detailChange",
|
||||
"type": "remove",
|
||||
"summary": "移除 storage.entry.addDetail / deleteDetail / detailChange 对外接口",
|
||||
"detail": "入库单明细编辑能力不再通过 systemMethods 对外暴露,入库单模块仅保留 list/get/cancel/completeEntry。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.08-system-20",
|
||||
"date": "2026-04-08",
|
||||
"module": "storage",
|
||||
"method": "storage.stockout.list, storage.stockout.toOrder, storage.stockout.listItems",
|
||||
"type": "add",
|
||||
"summary": "新增 storage.stockout 出库单模块(非订单出库单能力)",
|
||||
"detail": "新增 storage.stockout.list / toOrder / listItems 接口,作为非订单出库单的主出口(对应奇门 stockout.create)。storage.delivery.* 仅作为兼容转发保留;底层部分能力仍复用 order 模块。"
|
||||
},
|
||||
{
|
||||
"id": "2026.04.08-system-21",
|
||||
"date": "2026-04-08",
|
||||
"method": "storage.stockout.toOrder",
|
||||
"type": "change",
|
||||
"summary": "将 storage.stockout.toOrder 标记为占位接口",
|
||||
"detail": "storage.stockout.toOrder 当前仅保留方法名用于后续扩展,暂不开放实际逻辑。调用时返回 code=405、message=占位接口,暂未开放。"
|
||||
}
|
||||
,
|
||||
{
|
||||
"version": "2026.04.09-system-01",
|
||||
"date": "2026-04-09",
|
||||
"summary": "storage.entry.cancel 支持批量作废,新增 ids 入参并兼容单条 id",
|
||||
"methods": [
|
||||
"storage.entry.cancel"
|
||||
],
|
||||
"notes": [
|
||||
"新增入参 `ids`(number[])以支持批量作废,兼容旧入参 `id`;当同时传入 `ids` 与 `id` 时以 `ids` 为准。",
|
||||
"参数校验:`ids` 必须为非空数组;非法 ID 或空数组返回 400。",
|
||||
"业务约束:已完成/已作废/处于不可作废状态的单据不允许作废;批量场景下任一单据不存在或状态不允许时整体返回 404/400,未执行部分更新。",
|
||||
"响应说明:单条作废返回字段 `id`(number);批量作废返回字段 `ids`(number[])。",
|
||||
"已同步更新 methods/system.json(storage.entry.cancel)为 SSOT。"
|
||||
]
|
||||
}
|
||||
,
|
||||
{
|
||||
"id": "2026.04.09-system-02",
|
||||
"date": "2026-04-09",
|
||||
"method": "index.recognizeLicensePlate",
|
||||
"type": "added",
|
||||
"summary": "新增基础模块车牌识别接口 index.recognizeLicensePlate",
|
||||
"detail": "新增 recognizeLicensePlate 方法,归属基础模块(index),接收 base64 图片(字段 base64/ imageBase64/ image_base64),返回识别结果包含 licensePlate, plateNumber, color, confidence, requestId, imageSize, rawData。isNeedAuth=false, isNeedLogin=true。",
|
||||
"notes": [
|
||||
"入参:base64(string,必填)或 imageBase64/image_base64(兼容)",
|
||||
"响应:返回归一化后的识别对象,包含 licensePlate、plateNumber、color、confidence、requestId、imageSize、rawData",
|
||||
"错误:400(参数或图片格式/尺寸问题),500(第三方 OCR 调用失败或云密钥未配置)",
|
||||
"文档中不包含任何敏感配置;实际腾讯云密钥保留在配置文件中,勿在文档中暴露。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "2026.04.09-system-03",
|
||||
"date": "2026-04-09",
|
||||
"method": "index.recognizeLicensePlate",
|
||||
"type": "changed",
|
||||
"summary": "收紧基础模块车牌识别接口响应,仅返回 licensePlate 字段",
|
||||
"detail": "为简化对外契约,index.recognizeLicensePlate 的响应已从包含 licensePlate、plateNumber、color、confidence、requestId、imageSize、rawData 调整为仅包含 licensePlate。isNeedAuth=false, isNeedLogin=true。",
|
||||
"notes": [
|
||||
"出参由 {licensePlate, plateNumber, color, confidence, requestId, imageSize, rawData} 调整为 {licensePlate}",
|
||||
"调用方请仅依赖 licensePlate 字段以适配新版本;历史字段已裁剪且不再保证存在。",
|
||||
"文档中未包含任何云密钥或敏感配置信息。"
|
||||
]
|
||||
}
|
||||
]
|
||||
{
|
||||
"version": "2026.04.07-system-02",
|
||||
"date": "2026-04-07",
|
||||
"summary": "补充签约配置相关接口文档,覆盖策略字段元信息查询与面单数量人工调整。",
|
||||
"methods": [
|
||||
"storeWarehouse.store.getPolicyConfigFields",
|
||||
"storeWarehouse.store.adjustPrintQuantity"
|
||||
],
|
||||
"notes": [
|
||||
"getPolicyConfigFields 说明为获取签约策略可配置字段元信息列表。",
|
||||
"adjustPrintQuantity 说明为人工调整签约关系下的面单余额并记录变更日志,并 明确 id、change_quantity、reason 等关键入参。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "2026.04.07-system-03",
|
||||
"date": "2026-04-07",
|
||||
"summary": "对外命名从 qimenConfig 收口为 apiConfig,并在接口配置文档中强调 interface_type_id 校验。",
|
||||
"methods": [
|
||||
"storeWarehouse.store.listApiConfig",
|
||||
"storeWarehouse.store.saveApiConfig",
|
||||
"storeWarehouse.store.deleteQimenConfig"
|
||||
],
|
||||
"notes": [
|
||||
"文档对外统一使用 apiConfig / api_config 命名,减少 qimenConfig 历史别名歧义。",
|
||||
"saveApiConfig 要求 interface_type_id 为必填且必须指向已存在的 wms_interface_type 记录。",
|
||||
"listApiConfig / deleteQimenConfig 同步补充 interface_type_id 字段说明。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "2026.04.07-system-04",
|
||||
"date": "2026-04-07",
|
||||
"summary": "补充 /api/docs 文档体验增强说明,新增查看变更记录与查看原文 JSON 的入口说明。",
|
||||
"methods": [
|
||||
"/api/docs",
|
||||
"/api/docs/:docName",
|
||||
"/api/docs/:docName/raw",
|
||||
"/api/docs/:docName/changes"
|
||||
],
|
||||
"notes": [
|
||||
"sidecar 变更数组用于承载文档历史说明,不替代 methods/system.json 作为 SSOT。",
|
||||
"原文 JSON 入口继续用于直接查看当前生效文档。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "2026.04.07-system-05",
|
||||
"date": "2026-04-07",
|
||||
"summary": "修正 storeWarehouse.store.adjustPrintQuantity 的面单余额调整语义:由增减/累加改为覆盖设置目标余额。",
|
||||
"methods": [
|
||||
"storeWarehouse.store.adjustPrintQuantity"
|
||||
],
|
||||
"notes": [
|
||||
"adjustPrintQuantity 当前兼容 print_quantity、target_quantity、change_quantity、adjust_quantity 作为目标面单余额输入,不再按增减量解释。",
|
||||
"变更日志中的 change_quantity 由 before/after 自动计算差值,以兼容历史审计与展示。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "2026.04.07-system-06",
|
||||
"date": "2026-04-07",
|
||||
"summary": "按接口类型分类限制必填字段,OPEN_API 创建时自动生成 self_app_key/self_app_secret",
|
||||
"methods": [
|
||||
"storeWarehouse.store.saveApiConfig"
|
||||
],
|
||||
"notes": [
|
||||
"QM_WMS 类型须填写 qimen_app_key/qimen_customer_id/qimen_warehouse_code;OPEN_API 类型三个奇门字段非必填,创建时自动生成 self_app_key(WMS+32位HEX)和 self_app_secret(64位HEX),更新时保留已有密钥。"
|
||||
],
|
||||
"type": "changed"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.07-system-07",
|
||||
"date": "2026-04-07",
|
||||
"summary": "新增接口类型列表查询接口,归属基础模块,无需权限",
|
||||
"methods": [
|
||||
"index.listInterfaceTypes"
|
||||
],
|
||||
"notes": [
|
||||
"返回所有已启用的接口类型(wms_interface_type),包含 id、interface_code、interface_name、interface_category、description 字段。设置 isNeedAuth: false, isNeedLogin: true。"
|
||||
],
|
||||
"type": "added"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.07-system-08",
|
||||
"date": "2026-04-07",
|
||||
"summary": "app_name 改为必传参数",
|
||||
"methods": [
|
||||
"storeWarehouse.store.saveApiConfig"
|
||||
],
|
||||
"notes": [
|
||||
"app_name 不再有默认值自动生成逻辑,调用方必须传入非空的 app_name,否则返 回 400 错误。"
|
||||
],
|
||||
"type": "changed"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.07-system-09",
|
||||
"date": "2026-04-07",
|
||||
"summary": "新增收货单快捷入库上架接口",
|
||||
"methods": [
|
||||
"storage.inventory.quickPutaway"
|
||||
],
|
||||
"notes": [
|
||||
"新建 storage.inventory 库存操作模块。quickPutaway 从收货单直接生成入库单 (SCRK)并写入 wms_storage 库存表,同时更新 wms_stock_warehouse 库存数量(悲观行锁),回填收货明细入库状态。要求收货单已完成且所有明细已匹配系统商品。"
|
||||
],
|
||||
"type": "added"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.08-system-01",
|
||||
"date": "2026-04-08",
|
||||
"summary": "新增收货单与入库单匹配入库接口",
|
||||
"methods": [
|
||||
"storage.inventory.matchPutaway"
|
||||
],
|
||||
"notes": [
|
||||
"接收多个收货单和入库单,按商品(stock_warehouse_id)进行数量匹配入库,完 成后根据入库单来源(QM/API)自动触发回传。入参为 receiving_ids(数组)和 entry_order_ids(数组),返回匹配汇总、各收货单入库状态、各入库单状态及回传结果。isNeedAuth=true, isNeedLogin=true, isNeedRight=false。"
|
||||
],
|
||||
"type": "added"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.08-system-02",
|
||||
"date": "2026-04-08",
|
||||
"summary": "saveApiConfig 新增 callback_url 可选参数",
|
||||
"methods": [
|
||||
"storeWarehouse.store.saveApiConfig"
|
||||
],
|
||||
"notes": [
|
||||
"新增 callback_url 参数(VARCHAR(500),可选),用于 OPEN_API 类型入库单的 回调地址配置。"
|
||||
],
|
||||
"type": "changed"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.08-system-03",
|
||||
"date": "2026-04-08",
|
||||
"summary": "serializeQimenConfig 新增返回 callback_url 字段,影响 list 和 listApiConfig 两个接口",
|
||||
"methods": [
|
||||
"storeWarehouse.store.list",
|
||||
"storeWarehouse.store.listApiConfig"
|
||||
],
|
||||
"notes": [
|
||||
"serializeQimenConfig() 序列化方法新增 callback_url(string)字段。storeWarehouse.store.list 返回的每条记录 api_config 对象中包含 callback_url;storeWarehouse.store.listApiConfig 返回的 list 数组中每条配置包含 callback_url。"
|
||||
],
|
||||
"type": "changed"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.08-system-04",
|
||||
"date": "2026-04-08",
|
||||
"summary": "新增库存移库(库位转移)接口",
|
||||
"methods": [
|
||||
"storage.inventory.transferLocation"
|
||||
],
|
||||
"notes": [
|
||||
"新增 storage.inventory.transferLocation 接口,支持批量多商品多库位移库, 包含部分数量移库与全量移库。入参为 warehouse_id(仓库ID)和 transfers 数组(storage_id、target_space_id、quantity),触发 storage_transfer_completed 通知事件, 每条移库记录独立操作日志。isNeedAuth=true, isNeedLogin=true。"
|
||||
],
|
||||
"type": "added"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.08-system-05",
|
||||
"date": "2026-04-08",
|
||||
"summary": "简化移库接口入参,从批量 transfers 数组改为单条移库",
|
||||
"methods": [
|
||||
"storage.inventory.transferLocation"
|
||||
],
|
||||
"notes": [
|
||||
"移除 warehouse_id 和 transfers 数组入参,改为扁平的 storage_id + target_space_id + quantity 三个顶层参数。warehouse_id 从库存记录自动获取,接口从批量移库简化为单商品单库位移库。响应结构同步简化为单条结果对象。"
|
||||
],
|
||||
"type": "modified"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.08-system-06",
|
||||
"date": "2026-04-08",
|
||||
"summary": "新增商品库存明细查询接口",
|
||||
"methods": [
|
||||
"stock.warehouse.getStockDetail"
|
||||
],
|
||||
"notes": [
|
||||
"新增 stock.warehouse.getStockDetail 接口,按库位/批次维度查询商品库存分布。入参为 stock_id(必填,商品库存ID)和 pagination(可选,含 page/pageSize)。返回 stockItem(商品概要)、storageList(wms_storage 明细数组,含批次号、库位、数 量、锁定数量、生产日期、过期日期等,关联 location_space 库位信息)、pagination 分页信息。isNeedAuth=false, isNeedLogin=true。底层调用 stockStore.getStockDetail,自动校验商品归属当前仓库。"
|
||||
],
|
||||
"type": "added"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.08-system-07",
|
||||
"date": "2026-04-08",
|
||||
"summary": "新增入参 group_by_batch,支持按批次维度切换库存明细聚合方式",
|
||||
"methods": [
|
||||
"stock.warehouse.getStockDetail"
|
||||
],
|
||||
"notes": [
|
||||
"新增可选布尔参数 group_by_batch(默认 false)。false 时按库位合并数量,批次相关字段(batch_no, production_date, expiry_date, inbound_time, inbound_order_no, supplier_batch_no)置 null;true 时保持原逻辑返回每条明细。出参结构不变,但 storageList 中批次字段在合并模式下为 null。"
|
||||
],
|
||||
"type": "modified"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.08-system-08",
|
||||
"date": "2026-04-08",
|
||||
"summary": "新增按商品维度移库接口",
|
||||
"methods": [
|
||||
"storage.inventory.transferByProduct"
|
||||
],
|
||||
"notes": [
|
||||
"新增 storage.inventory.transferByProduct 接口,按库位+商品查找所有库存记 录合并移动。入参为 space_id(原库位ID)、stock_id(商品SKU ID,即 wms_stock_warehouse.id)、target_space_id(目标库位ID)、quantity(移库数量)。开启批次管理(is_batch_mgmt=Y)的商品会被拒绝,需使用 transferLocation 按库存记录精确移库。复用 storage_transfer_completed 通知事件,操作日志编码 STORAGE_TRANSFER_BY_PRODUCT。isNeedAuth=true, isNeedLogin=true。"
|
||||
],
|
||||
"type": "added"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.08-system-09",
|
||||
"date": "2026-04-08",
|
||||
"summary": "补充 storeWarehouse.store.list 完整 response 输出字段说明,移除 api_config / apiConfig",
|
||||
"methods": [
|
||||
"storeWarehouse.store.list"
|
||||
],
|
||||
"notes": [
|
||||
"从返回结果中移除 api_config 和 apiConfig 字段(代码中 delete serialized.api_config / delete serialized.apiConfig),文档 response 补充完整输出字段列表:id, store_id, store_name, warehouse_id, warehouse_name, counterparty_id, counterparty_name, current_subject_role, auth_status, auth_status_label, apply_reason, review_comment, apply_time, review_time, auth_start, auth_end, actual_end, print_quantity, applied_by, reviewed_by, ended_by, remask, use_status, policy_config, is_auth_valid, remaining_days 以及分页和 current_subject 信息。"
|
||||
],
|
||||
"type": "updated"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.08-system-10",
|
||||
"date": "2026-04-08",
|
||||
"summary": "货主列表返回新增 has_qimen_config 布尔字段",
|
||||
"methods": [
|
||||
"storeWarehouse.store.list"
|
||||
],
|
||||
"notes": [
|
||||
"storeWarehouse.store.list 返回的 data.list[] 中新增 has_qimen_config(boolean),表示该货主是否已配置奇门。"
|
||||
],
|
||||
"type": "changed"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.08-system-11",
|
||||
"date": "2026-04-08",
|
||||
"summary": "补全 stock.warehouse.search 接口文档,新增 params / response / errors 完整说明",
|
||||
"methods": [
|
||||
"stock.warehouse.search"
|
||||
],
|
||||
"notes": [
|
||||
"入参补充 keyword(string,模糊匹配 item_code / item_name / goods_code / barcode)和 store_id(number,按货主筛选)。响应补充 data 数组各字段(id, item_code, goods_code, item_name, sku_property, stock_unit, quantity, locked_quantity, brand_name, item_type, barcodes, store_stock)以及 total。errors 补充 code=0 搜 索失败场景。"
|
||||
],
|
||||
"type": "updated"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.08-system-12",
|
||||
"date": "2026-04-08",
|
||||
"summary": "新增 with_stock / is_batch 参数,支持返回关联库存明细(按库位分 组或按批次逐条)",
|
||||
"methods": [
|
||||
"stock.warehouse.search"
|
||||
],
|
||||
"notes": [
|
||||
"入参新增 with_stock(boolean,默认 false,是否返回关联库存数据)和 is_batch(boolean,默认 false,仅 with_stock=true 时生效,按批次明细返回)。响应 data[] 新增 storage[] 字段:is_batch=false 时按库位分组汇总(含 space_id、space、inventory_type、quantity、locked_quantity、available_quantity);is_batch=true 时逐 条返回批次明细(含 id、stock_id、space_id、batch_no、inventory_type、quantity、locked_quantity、available_quantity、production_date、expiry_date、inbound_time、inbound_order_no、supplier_batch_no、created_at、space)。"
|
||||
],
|
||||
"type": "updated"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.08-system-13",
|
||||
"date": "2026-04-08",
|
||||
"summary": "新增 wms_stock_transaction 表和模型",
|
||||
"methods": [
|
||||
"wms_stock_transaction"
|
||||
],
|
||||
"notes": [
|
||||
"新增出入库流水记录表 wms_stock_transaction,含 transaction_type(INBOUND/OUTBOUND)、warehouse_id、store_id、stock_id、storage_id、space_id、quantity、batch_no、inventory_type、order_type、order_no、order_id、receiving_id、entry_order_id、operator_id、operator_name、remark 等字段,关联 StockWarehouse 和 Storage 模型。"
|
||||
],
|
||||
"type": "added"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.08-system-14",
|
||||
"date": "2026-04-08",
|
||||
"summary": "quickPutaway 和 matchPutaway 入库时自动写入出入库记录",
|
||||
"methods": [
|
||||
"storage.inventory.quickPutaway",
|
||||
"storage.inventory.matchPutaway"
|
||||
],
|
||||
"notes": [
|
||||
"入库操作完成后自动写入 wms_stock_transaction 记录。quickPutaway 写入 order_type='SCRK'(收货入库),matchPutaway 写入 order_type='MATCH'(匹配入库),均 自动填充 warehouse_id、store_id、stock_id、storage_id、space_id、quantity、batch_no、inventory_type 等字段。"
|
||||
],
|
||||
"type": "updated"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.08-system-15",
|
||||
"date": "2026-04-08",
|
||||
"summary": "新增 storage.inventory.list 出入库记录列表查询接口",
|
||||
"methods": [
|
||||
"storage.inventory.list"
|
||||
],
|
||||
"notes": [
|
||||
"出入库记录列表查询,支持 where 条件(transaction_type、stock_id、space_id、store_id、order_type、order_no、inventory_type、operator_name、created_at)、 分页(pagination)、排序(sort)和 group_by_batch 参数。默认合并模式按库位+商品 聚合返回合计数量与记录条数,group_by_batch=true 时返回每条明细含 batch_no、order_no、operator_name 等完整信息。响应均关联 stockItem(item_code、item_name、sku_property、stock_unit)。"
|
||||
],
|
||||
"type": "added"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.08-system-16",
|
||||
"date": "2026-04-08",
|
||||
"summary": "出入库流水记录查询接口从 storage.inventory.list 改名为 storage.transaction.list",
|
||||
"methods": [
|
||||
"storage.transaction.list"
|
||||
],
|
||||
"notes": [
|
||||
"将出入库流水记录查询从 storage.inventory.list 迁移到 storage.transaction.list,避免与库存列表概念混淆。功能和参数不变。isNeedAuth=false, isNeedLogin=true, isNeedRight=false。"
|
||||
],
|
||||
"type": "rename",
|
||||
"module": "storage"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.08-system-17",
|
||||
"date": "2026-04-08",
|
||||
"summary": "新增 storage.inventory.list 库存列表查询接口",
|
||||
"methods": [
|
||||
"storage.inventory.list"
|
||||
],
|
||||
"notes": [
|
||||
"新增库存列表查询接口,查询 wms_storage 表。支持 where 条件(stock_id/space_id/store_id/inventory_type/batch_no/inbound_order_no/available_quantity/inbound_time/created_at)、分页、排序。支持 group_by_batch 参数:默认 false 按库位+商 品合并(SUM quantity/locked_quantity/available_quantity),true 返回每条明细含 batch_no/production_date/expiry_date 等。关联 stockItem(商品信息)和 space(库位信息)。isNeedAuth=false, isNeedLogin=true, isNeedRight=false。"
|
||||
],
|
||||
"type": "add",
|
||||
"module": "storage"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.08-system-18",
|
||||
"date": "2026-04-08",
|
||||
"summary": "移除 storage.entry.create 创建入库单接口",
|
||||
"methods": [
|
||||
"storage.entry.create"
|
||||
],
|
||||
"notes": [
|
||||
"不再允许通过 API 创建入库单。入库单仅由快捷入库(quickPutaway)和匹配入库(matchPutaway)等内部流程自动创建。底层 service 实现保留但不再通过 systemMethods 对外暴露。"
|
||||
],
|
||||
"type": "remove",
|
||||
"module": "storage"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.08-system-19",
|
||||
"date": "2026-04-08",
|
||||
"summary": "移除 storage.entry.addDetail / deleteDetail / detailChange 对外 接口",
|
||||
"methods": [
|
||||
"storage.entry.addDetail",
|
||||
"storage.entry.deleteDetail",
|
||||
"storage.entry.detailChange"
|
||||
],
|
||||
"notes": [
|
||||
"入库单明细编辑能力不再通过 systemMethods 对外暴露,入库单模块仅保留 list/get/cancel/completeEntry。"
|
||||
],
|
||||
"type": "remove",
|
||||
"module": "storage"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.08-system-20",
|
||||
"date": "2026-04-08",
|
||||
"summary": "新增 storage.stockout 出库单模块(非订单出库单能力)",
|
||||
"methods": [
|
||||
"storage.stockout.list",
|
||||
"storage.stockout.toOrder",
|
||||
"storage.stockout.listItems"
|
||||
],
|
||||
"notes": [
|
||||
"新增 storage.stockout.list / toOrder / listItems 接口,作为非订单出库单的主出口(对应奇门 stockout.create)。storage.delivery.* 仅作为兼容转发保留;底层 部分能力仍复用 order 模块。"
|
||||
],
|
||||
"type": "add",
|
||||
"module": "storage"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.08-system-21",
|
||||
"date": "2026-04-08",
|
||||
"summary": "将 storage.stockout.toOrder 标记为占位接口",
|
||||
"methods": [
|
||||
"storage.stockout.toOrder"
|
||||
],
|
||||
"notes": [
|
||||
"storage.stockout.toOrder 当前仅保留方法名用于后续扩展,暂不开放实际逻辑。调用时返回 code=405、message=占位接口,暂未开放。"
|
||||
],
|
||||
"type": "change"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.09-system-01",
|
||||
"date": "2026-04-09",
|
||||
"summary": "storage.entry.cancel 支持批量作废,新增 ids 入参并兼容单条 id",
|
||||
"methods": [
|
||||
"storage.entry.cancel"
|
||||
],
|
||||
"notes": [
|
||||
"新增入参 `ids`(number[])以支持批量作废,兼容旧入参 `id`;当同时传入 `ids` 与 `id` 时以 `ids` 为准。",
|
||||
"参数校验:`ids` 必须为非空数组;非法 ID 或空数组返回 400。",
|
||||
"业务约束:已完成/已作废/处于不可作废状态的单据不允许作废;批量场景下任一 单据不存在或状态不允许时整体返回 404/400,未执行部分更新。",
|
||||
"响应说明:单条作废返回字段 `id`(number);批量作废返回字段 `ids`(number[])。",
|
||||
"已同步更新 methods/system.json(storage.entry.cancel)为 SSOT。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "2026.04.09-system-02",
|
||||
"date": "2026-04-09",
|
||||
"summary": "新增基础模块车牌识别接口 index.recognizeLicensePlate",
|
||||
"methods": [
|
||||
"index.recognizeLicensePlate"
|
||||
],
|
||||
"notes": [
|
||||
"入参:base64(string,必填)或 imageBase64/image_base64(兼容)",
|
||||
"响应:返回归一化后的识别对象,包含 licensePlate、plateNumber、color、confidence、requestId、imageSize、rawData",
|
||||
"错误:400(参数或图片格式/尺寸问题),500(第三方 OCR 调用失败或云密钥未 配置)",
|
||||
"文档中不包含任何敏感配置;实际腾讯云密钥保留在配置文件中,勿在文档中暴露 。"
|
||||
],
|
||||
"type": "added"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.09-system-03",
|
||||
"date": "2026-04-09",
|
||||
"summary": "收紧基础模块车牌识别接口响应,仅返回 licensePlate 字段",
|
||||
"methods": [
|
||||
"index.recognizeLicensePlate"
|
||||
],
|
||||
"notes": [
|
||||
"出参由 {licensePlate, plateNumber, color, confidence, requestId, imageSize, rawData} 调整为 {licensePlate}",
|
||||
"调用方请仅依赖 licensePlate 字段以适配新版本;历史字段已裁剪且不再保证存 在。",
|
||||
"文档中未包含任何云密钥或敏感配置信息。"
|
||||
],
|
||||
"type": "changed"
|
||||
},
|
||||
{
|
||||
"version": "2026.04.10-system-01",
|
||||
"date": "2026-04-10",
|
||||
"summary": "订单审核字段由 audit_status 替换为整数字段 step,并添加数据库迁移",
|
||||
"methods": [
|
||||
"order.getreviewOrderlist",
|
||||
"order.reviewOrder.getreviewOrderlist",
|
||||
"order.reviewOrder.reviewOrder",
|
||||
"order.deliveryOrder.getdeliveryOrderlist",
|
||||
"order.list",
|
||||
"order.stats"
|
||||
],
|
||||
"notes": [
|
||||
"字段变更:order 相关审核字段从字符串/枚举 audit_status 替换为整数 step。",
|
||||
"step 映射:0=未审核,1=已审核,2=处理中,3=驳回/异常,4=配送中,5=已完成,9=已关闭。",
|
||||
"reviewOrder 接口在更新 inspection_status 的同时会写入 step 字段。",
|
||||
"必须执行迁移脚本:20260410150000-replace-audit-status-with-step-on-order-delivery-tables.js"
|
||||
],
|
||||
"type": "changed"
|
||||
}
|
||||
]
|
||||
|
||||
@ -580,7 +580,7 @@
|
||||
"type": "object",
|
||||
"required": false,
|
||||
"source": "body",
|
||||
"description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构,历史简写会在 main 中自动标准化;常用字段包括 delivery_order_code、status、outbound_status、buyer_nick、mobile 与日期区间字段。示例:where.delivery_order_code={operator:like,value:SO202603}; where.status={operator:in,value:[created,pedding]}。"
|
||||
"description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构,历史简写会在 main 中自动标准化;常用字段包括 delivery_order_code、status、step、outbound_status、buyer_nick、mobile 与日期区间字段。示例:where.delivery_order_code={operator:like,value:SO202603}; where.status={operator:in,value:[created,pedding]}; where.step={operator:eq,value:1}。"
|
||||
}
|
||||
],
|
||||
"response": [],
|
||||
@ -701,7 +701,7 @@
|
||||
"type": "object",
|
||||
"required": false,
|
||||
"source": "body",
|
||||
"description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构;支持 inspection_status、operator_name、operate_time_start、operate_time_end 等字段。示例:where.inspection_status={operator:eq,value:pending}; where.operator_name={operator:like,value:张}; where.operate_time_start={value:2026-03-01}。"
|
||||
"description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构;支持 inspection_status、step、operator_name、operate_time_start、operate_time_end 等字段。示例:where.step={operator:in,value:[0,1]}; where.inspection_status={operator:eq,value:pending}; where.operator_name={operator:like,value:张}; where.operate_time_start={value:2026-03-01}。"
|
||||
}
|
||||
],
|
||||
"response": [],
|
||||
@ -934,7 +934,7 @@
|
||||
"type": "object",
|
||||
"required": false,
|
||||
"source": "body",
|
||||
"description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构;支持 inspection_status、operator_name、operate_time_start、operate_time_end 等字段。示例:where.inspection_status={operator:eq,value:pending}; where.operator_name={operator:like,value:张}; where.operate_time_start={value:2026-03-01}。"
|
||||
"description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构;支持 inspection_status、step、operator_name、operate_time_start、operate_time_end 等字段。示例:where.step={operator:in,value:[0,1]}; where.inspection_status={operator:eq,value:pending}; where.operator_name={operator:like,value:张}; where.operate_time_start={value:2026-03-01}。"
|
||||
}
|
||||
],
|
||||
"response": [],
|
||||
@ -942,7 +942,7 @@
|
||||
},
|
||||
{
|
||||
"method": "order.reviewOrder.reviewOrder",
|
||||
"description": "订单审核(目录化路由)",
|
||||
"description": "订单审核(目录化路由)。执行后会更新 inspection_status,并同步更新订单整数字段 step。",
|
||||
"isNeedAuth": false,
|
||||
"isNeedLogin": true,
|
||||
"headers": [
|
||||
@ -1026,7 +1026,7 @@
|
||||
"type": "object",
|
||||
"required": false,
|
||||
"source": "body",
|
||||
"description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构;未传 outbound_status 时默认过滤 outbound_status != none。示例:where.outbound_status={operator:in,value:[created,processing]}; where.store_id={operator:eq,value:1001}。"
|
||||
"description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构;未传 outbound_status 时默认过滤 outbound_status != none;支持 step 筛选。示例:where.outbound_status={operator:in,value:[created,processing]}; where.step={operator:in,value:[4,5]}; where.store_id={operator:eq,value:1001}。"
|
||||
}
|
||||
],
|
||||
"response": [],
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "oms",
|
||||
"name": "wms",
|
||||
"version": "1.0.0",
|
||||
"description": "奇门wms",
|
||||
"private": true,
|
||||
@ -43,6 +43,7 @@
|
||||
"start": "egg-scripts start ",
|
||||
"stop": "node ./app/lib/stop_current_egg.js",
|
||||
"dev": "egg-bin dev --port=6060",
|
||||
"file-writer:pressure": "node ./temp/generated-tests/file-writer-pressure.generated.test.cjs",
|
||||
"debug:webhook:receiver": "node ./script/debug-webhook-receiver.cjs",
|
||||
"debug:webhook:receiving": "node ./script/debug-send-receiving-webhooks.cjs",
|
||||
"deploy:init": "node ./script/deploy-init.cjs production",
|
||||
|
||||
1
runtime/file-writer/.write-window-counter-3.json
Normal file
1
runtime/file-writer/.write-window-counter-3.json
Normal file
@ -0,0 +1 @@
|
||||
{"startedAt":1775826309321,"recordCount":2}
|
||||
7
runtime/file-writer/qimen-logs/.consume-progress
Normal file
7
runtime/file-writer/qimen-logs/.consume-progress
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"filePath": "D:\\wms\\runtime\\file-writer\\qimen-logs\\2026\\04\\10\\qimen-logs-MINGREN-worker-p4496-0001.log",
|
||||
"offset": 6149,
|
||||
"processedCount": 2,
|
||||
"completedAt": "2026-04-10T14:20:54.561Z",
|
||||
"updatedAt": "2026-04-11T09:08:50.539Z"
|
||||
}
|
||||
@ -0,0 +1,2 @@
|
||||
{"log_id":"QL-1775804691322-cfe013","from_key":"24869601","to_key":23535631,"method":"deliveryorder.create","sign":"05687722A46473E4018E0EBAAAB84E96","costomer_id":"jky2025102001","v":"2.0","url":"http://127.0.0.1:6060/qimen?app_key=24869601&method=deliveryorder.create&v=2.0&format=xml&sign_method=md5&customerId=jky2025102001&sign=05687722A46473E4018E0EBAAAB84E96×tamp=2026-01-13+23%3A26%3A07","created_at":"2026-04-10T07:04:51.322Z","body":"<?xml version=\"1.0\" encoding=\"utf-8\"?><request><deliveryOrder><deliveryOrderCode>SIM20260410070451</deliveryOrderCode><preDeliveryOrderCode /><preDeliveryOrderId /><orderType>JYCK</orderType><warehouseCode>100000</warehouseCode><orderFlag /><sourcePlatformCode>PDD</sourcePlatformCode><sourcePlatformName>拼多多</sourcePlatformName><buyerMessage /><sellerMessage /><createTime>2026-01-13 23:26:07</createTime><placeOrderTime>2026-01-13 23:22:03</placeOrderTime><payTime>2026-01-13 23:22:03</payTime><payNo /><shopNick>火火家de小店</shopNick><shopCode>0675</shopCode><sellerNick>1</sellerNick><buyerNick>刘付明仁18022440198</buyerNick><operatorName>1</operatorName><totalAmount>10</totalAmount><arAmount>0</arAmount><itemAmount>10</itemAmount><discountAmount>0</discountAmount><freight>0</freight><logisticsCode>SFKY</logisticsCode><logisticsName>顺丰空运</logisticsName><expressCode /><operateTime>2026-01-13 23:26:07</operateTime><isUrgency>N</isUrgency><invoiceFlag>N</invoiceFlag><senderInfo><company>火火家de小店</company><name>1</name><zipCode /><tel>1</tel><mobile>1</mobile><countryCode>CN</countryCode><province>广东省</province><city>广州市</city><area>从化区</area><town>太平镇</town><detailAddress>天豹云仓</detailAddress></senderInfo><receiverInfo><name>刘付明仁</name><zipCode /><tel /><mobile>18022440198</mobile><email /><countryCode>CN</countryCode><province>广东省</province><city>广州市</city><area>白云区</area><town>太和镇</town><detailAddress>广东省 广州市 白云区 太和镇 二路32号</detailAddress><idType>1</idType><idNumber /><oaid /></receiverInfo><remark /><logisticsAreaCode /><insuranceFlag>N</insuranceFlag><gotAmount>0</gotAmount><oaidOrderSourceCode /></deliveryOrder><orderLines><orderLine><orderLineNo>1</orderLineNo><ownerCode>jky2025102001</ownerCode><itemCode>011000000228</itemCode><itemId>1000649</itemId><itemName>测试</itemName><planQty>10</planQty><sourceOrderCode /><subSourceOrderCode /><actualPrice>1</actualPrice><extCode /><batchCode /><retailPrice>1</retailPrice><discountAmount>0</discountAmount><produceCode /><inventoryType>ZP</inventoryType><payNo /><extendProps><RealPayMoney>10</RealPayMoney><shareAmount>10</shareAmount></extendProps></orderLine></orderLines><extendProps><taxAmount>0</taxAmount><taxFee>0</taxFee><actualAmount>0</actualAmount><tariffAmount>0</tariffAmount><consumptionDutyAmount>0</consumptionDutyAmount><addedValueTaxAmount>0</addedValueTaxAmount><discountAmount>0</discountAmount><platDiscountAmount>0</platDiscountAmount><declaringValueAmount>0</declaringValueAmount><pdd_plat_discount>0</pdd_plat_discount><ewaybill_order_code /><selfSupport>false</selfSupport><innerProps /></extendProps></request>","result":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<response>\n <flag>failure</flag>\n <code>0</code>\n <message>奇门吉客云ERP客户编码jky2025102001仓库编码warehouseCode未绑定到你的货主或未启用,请联系仓库绑定</message>\n</response>","use_time":98}
|
||||
{"log_id":"QL-1775804829940-8ee9f4","from_key":"23060081","to_key":23535631,"method":"deliveryorder.create","sign":"F4AC9969DF96CBDBCE02CF60982F2984","costomer_id":"4","v":"2.0","url":"http://127.0.0.1:6060/qimen?app_key=23060081&method=deliveryorder.create&v=2.0&format=xml&sign_method=md5&customerId=4&sign=F4AC9969DF96CBDBCE02CF60982F2984×tamp=2026-01-13+23%3A27%3A38","created_at":"2026-04-10T07:07:09.940Z","body":"<request><deliveryOrder><buyerNick>刘付明仁</buyerNick><createTime>2026-01-13 23:27:36</createTime><deliveryOrderCode>SIM20260410070709</deliveryOrderCode><discountAmount>0.00</discountAmount><freight>0</freight><gotAmount>0.00</gotAmount><itemAmount>0</itemAmount><latestDeliveryTime>2026-01-15 22:51:36</latestDeliveryTime><logisticsCode>SFKY</logisticsCode><logisticsName>顺丰速运_空运</logisticsName><operateTime>2026-01-13 23:27:36</operateTime><orderType>JYCK</orderType><payNo>S20260113225136223</payNo><payTime>2026-01-13 22:51:36</payTime><placeOrderTime>2026-01-13 22:49:50</placeOrderTime><receiverInfo><area>白云区</area><city>广州市</city><detailAddress>钟落潭良沙二路32号</detailAddress><mobile>18022440198</mobile><name>刘付明仁</name><province>广东省</province><extendProps></extendProps></receiverInfo><remark>S260113225136208</remark><senderInfo><area>白云区</area><city>广州市</city><detailAddress>1</detailAddress><mobile>18022440198</mobile><name>天豹测试仓15271658</name><province>广东省</province></senderInfo><shopNick>{线下}</shopNick><sourcePlatformCode>OFFLINE</sourcePlatformCode><sourcePlatformName>线下店铺</sourcePlatformName><totalAmount>0.00</totalAmount><warehouseCode>100000</warehouseCode><extendProps><oid>2042359</oid><subOrderType>Offline</subOrderType><isDecrypt>false</isDecrypt><shopId>0</shopId><isJitx>false</isJitx><isJdMobileDecrypt>true</isJdMobileDecrypt><buyer_paidamount>0</buyer_paidamount><sellerIncome_amount>0</sellerIncome_amount></extendProps></deliveryOrder><orderLines><orderLine><actualPrice>0</actualPrice><inventoryType>ZP</inventoryType><itemCode>023802</itemCode><itemId>1000218</itemId><itemName>空包</itemName><orderLineNo>1158149</orderLineNo><ownerCode>4</ownerCode><planQty>5</planQty><sourceOrderCode>S260113225136208</sourceOrderCode><extendProps><isGift>0</isGift></extendProps></orderLine></orderLines><extendProps></extendProps></request>","result":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<response>\n <flag>failure</flag>\n <code>0</code>\n <message>奇门聚水潭ERP客户编码4仓库编码warehouseCode未绑定到你的货主或未启用,请联系仓库绑定</message>\n</response>","use_time":88}
|
||||
@ -0,0 +1,7 @@
|
||||
{
|
||||
"filePath": "D:\\wms\\runtime\\file-writer\\qimen-logs\\2026\\04\\10\\qimen-logs-MINGREN-worker-p4496-0001.log",
|
||||
"offset": 6149,
|
||||
"processedCount": 2,
|
||||
"completedAt": "2026-04-10T14:20:54.561Z",
|
||||
"updatedAt": "2026-04-10T14:20:54.561Z"
|
||||
}
|
||||
@ -7,7 +7,12 @@ const {
|
||||
invokeGatewayMethod,
|
||||
} = require('../../support/system_method_client');
|
||||
|
||||
const YE4S_TEST_USER_ID = Number(process.env.SYSTEM_TEST_YE4S_USER_ID || 28);
|
||||
const YE4S_TEST_USER_ID = Number(process.env.SYSTEM_TEST_YE4S_USER_ID);
|
||||
|
||||
assert.ok(
|
||||
Number.isInteger(YE4S_TEST_USER_ID) && YE4S_TEST_USER_ID > 0,
|
||||
'SYSTEM_TEST_YE4S_USER_ID 必须显式提供且为正整数'
|
||||
);
|
||||
|
||||
describe('test/app/controller/gateway.user.bindAccountByTempCode.test.js', () => {
|
||||
it('should scan, bind, unbind, and bind again for ye4s user', async () => {
|
||||
|
||||
@ -14,6 +14,20 @@ const EXTRA_HEADERS = {
|
||||
const ALLOWED_REVIEW_STATUS = new Set([ 'none', 'padding', 'running', 'fin', 'error' ]);
|
||||
const FALLBACK_ROLE_IDS = [ 4, 6, 30 ];
|
||||
|
||||
function mapReviewStatusToStep(reviewStatus) {
|
||||
const status = String(reviewStatus || 'none').trim();
|
||||
if (status === 'fin') {
|
||||
return 1;
|
||||
}
|
||||
if (status === 'running' || status === 'padding') {
|
||||
return 2;
|
||||
}
|
||||
if (status === 'error') {
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
async function switchToWarehouseRoleWithOrderData(token) {
|
||||
let currentToken = token;
|
||||
const infoRes = await invokeSystemMethod('user.info', {}, currentToken, EXTRA_HEADERS);
|
||||
@ -129,6 +143,7 @@ describe('test/app/controller/system.order.namespaced.test.js', () => {
|
||||
assert.equal(reviewRes.body.code, 200);
|
||||
assert.equal(Number(reviewRes.body?.data?.id || 0), Number(order.id));
|
||||
assert.equal(reviewRes.body?.data?.inspection_status, targetStatus);
|
||||
assert.equal(Number(reviewRes.body?.data?.step), mapReviewStatusToStep(targetStatus));
|
||||
|
||||
const restoreRes = await invokeSystemMethod('order.reviewOrder.reviewOrder', {
|
||||
id: Number(order.id),
|
||||
@ -139,5 +154,45 @@ describe('test/app/controller/system.order.namespaced.test.js', () => {
|
||||
assert.equal(restoreRes.body.flag, 'success');
|
||||
assert.equal(restoreRes.body.code, 200);
|
||||
assert.equal(restoreRes.body?.data?.inspection_status, originalStatus);
|
||||
assert.equal(Number(restoreRes.body?.data?.step), mapReviewStatusToStep(originalStatus));
|
||||
});
|
||||
|
||||
it('should return step in delivery orders and support filtering', async () => {
|
||||
const { token } = await getAuthToken();
|
||||
const switched = await switchToWarehouseRoleWithOrderData(token);
|
||||
|
||||
const listRes = await invokeSystemMethod('order.deliveryOrder.getdeliveryOrderlist', {
|
||||
pagination: { page: 1, pageSize: 10 },
|
||||
where: {},
|
||||
}, switched.token, EXTRA_HEADERS);
|
||||
|
||||
assert.equal(listRes.status, 200);
|
||||
assert.equal(listRes.body.flag, 'success');
|
||||
assert.equal(listRes.body.code, 200);
|
||||
|
||||
const orders = listRes.body?.data?.list;
|
||||
assert.ok(Array.isArray(orders));
|
||||
|
||||
if (orders.length > 0) {
|
||||
assert.ok(Object.prototype.hasOwnProperty.call(orders[0], 'step'), '发货单应包含 step 字段');
|
||||
const sampleStep = Number(orders[0].step);
|
||||
|
||||
const filteredRes = await invokeSystemMethod('order.deliveryOrder.getdeliveryOrderlist', {
|
||||
pagination: { page: 1, pageSize: 10 },
|
||||
where: { step: sampleStep },
|
||||
}, switched.token, EXTRA_HEADERS);
|
||||
|
||||
assert.equal(filteredRes.status, 200);
|
||||
assert.equal(filteredRes.body.flag, 'success');
|
||||
assert.equal(filteredRes.body.code, 200);
|
||||
const filteredOrders = filteredRes.body?.data?.list;
|
||||
assert.ok(Array.isArray(filteredOrders));
|
||||
if (filteredOrders.length > 0) {
|
||||
assert.ok(
|
||||
filteredOrders.every(order => Number(order.step) === sampleStep),
|
||||
`按 step=${sampleStep} 过滤后,所有订单都应是该状态`
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -7,7 +7,12 @@ const {
|
||||
invokeGatewayMethod,
|
||||
} = require('../../support/system_method_client');
|
||||
|
||||
const YE4S_TEST_USER_ID = Number(process.env.SYSTEM_TEST_YE4S_USER_ID || 28);
|
||||
const YE4S_TEST_USER_ID = Number(process.env.SYSTEM_TEST_YE4S_USER_ID);
|
||||
|
||||
assert.ok(
|
||||
Number.isInteger(YE4S_TEST_USER_ID) && YE4S_TEST_USER_ID > 0,
|
||||
'SYSTEM_TEST_YE4S_USER_ID 必须显式提供且为正整数'
|
||||
);
|
||||
|
||||
const EXTRA_HEADERS = {
|
||||
platform: 'web',
|
||||
|
||||
@ -11,6 +11,20 @@ const EXTRA_HEADERS = {
|
||||
project: 'all',
|
||||
};
|
||||
|
||||
/**
|
||||
* 从列表中选出固定的测试签约关系。
|
||||
* @param {Array<object>} relations 签约关系列表。
|
||||
* @return {object|null} 固定测试关系,找不到时返回空。
|
||||
*/
|
||||
function pickFixedTestRelation(relations) {
|
||||
if (!Array.isArray(relations)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return relations.find(item => Number(item.store_id) === 1000000 && Number(item.warehouse_id) === 100000)
|
||||
|| null;
|
||||
}
|
||||
|
||||
describe('test/app/controller/system.setting.storeWarehouse.test.js', () => {
|
||||
const METHOD_PREFIX = 'storeWarehouse.store';
|
||||
let token = '';
|
||||
@ -32,9 +46,8 @@ describe('test/app/controller/system.setting.storeWarehouse.test.js', () => {
|
||||
assert.equal(res.body.code, 200);
|
||||
assert.ok(Array.isArray(res.body?.data?.list), 'list 应返回数组');
|
||||
assert.ok(res.body?.data?.current_subject, '应返回当前主体信息');
|
||||
sampleRelation = Array.isArray(res.body?.data?.list) && res.body.data.list.length > 0
|
||||
? res.body.data.list[0]
|
||||
: null;
|
||||
sampleRelation = pickFixedTestRelation(res.body?.data?.list);
|
||||
assert.ok(sampleRelation, '未找到固定测试仓/测试货主对应关系');
|
||||
});
|
||||
|
||||
it('should allow renaming current-side remask and reflect it in list display', async () => {
|
||||
@ -51,8 +64,8 @@ describe('test/app/controller/system.setting.storeWarehouse.test.js', () => {
|
||||
|
||||
const currentRole = String(listRes.body?.data?.current_subject?.role || '');
|
||||
const candidates = Array.isArray(listRes.body?.data?.list) ? listRes.body.data.list : [];
|
||||
const candidate = candidates.find(item => Number(item.id) > 0);
|
||||
assert.ok(candidate, '需要至少一条签约关系用于改名回归');
|
||||
const candidate = pickFixedTestRelation(candidates);
|
||||
assert.ok(candidate, '未找到固定测试仓/测试货主对应关系,无法改名回归');
|
||||
|
||||
const isWarehouse = currentRole === 'warehouse';
|
||||
const originRemask = String(candidate.remask || '');
|
||||
@ -98,34 +111,13 @@ describe('test/app/controller/system.setting.storeWarehouse.test.js', () => {
|
||||
it('should generate a temp code and support preview before confirmation', async () => {
|
||||
assert.ok(sampleRelation, '需要至少一条现有签约关系用于临时码回归');
|
||||
|
||||
const candidateRes = await invokeSystemMethod(`${METHOD_PREFIX}.list`, {
|
||||
page: 1,
|
||||
page_size: 30,
|
||||
const initRes = await invokeSystemMethod(`${METHOD_PREFIX}.sign`, {
|
||||
store_id: 1000000,
|
||||
warehouse_id: 100000,
|
||||
apply_reason: 'autotest temp sign flow',
|
||||
remask: `autotest_remask_${Date.now()}`,
|
||||
}, token, EXTRA_HEADERS);
|
||||
|
||||
assert.equal(candidateRes.status, 200);
|
||||
assert.equal(candidateRes.body.flag, 'success');
|
||||
assert.equal(candidateRes.body.code, 200);
|
||||
|
||||
const candidates = Array.isArray(candidateRes.body?.data?.list) ? candidateRes.body.data.list : [];
|
||||
assert.ok(candidates.length > 0, '需要至少一条签约关系用于临时码回归');
|
||||
|
||||
let initRes = null;
|
||||
for (const item of candidates) {
|
||||
const attempt = await invokeSystemMethod(`${METHOD_PREFIX}.sign`, {
|
||||
counterparty_id: Number(item.counterparty_id),
|
||||
apply_reason: 'autotest temp sign flow',
|
||||
remask: `autotest_remask_${Date.now()}`,
|
||||
}, token, EXTRA_HEADERS);
|
||||
|
||||
if (attempt.status === 200 && attempt.body && attempt.body.flag === 'success') {
|
||||
initRes = attempt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
assert.ok(initRes, '未找到可发起临时码签约的对方主体,请确认测试账号签约数据');
|
||||
|
||||
assert.equal(initRes.status, 200);
|
||||
assert.equal(initRes.body.flag, 'success');
|
||||
assert.equal(initRes.body.code, 200);
|
||||
@ -187,8 +179,8 @@ describe('test/app/controller/system.setting.storeWarehouse.test.js', () => {
|
||||
}
|
||||
|
||||
const candidates = Array.isArray(listRes.body?.data?.list) ? listRes.body.data.list : [];
|
||||
const candidate = candidates.find(item => Number(item.id) > 0);
|
||||
assert.ok(candidate, '需要至少一条签约关系用于策略配置回归');
|
||||
const candidate = pickFixedTestRelation(candidates);
|
||||
assert.ok(candidate, '未找到固定测试仓/测试货主对应关系,无法做策略配置回归');
|
||||
|
||||
const originalPolicyConfig = candidate.policy_config && typeof candidate.policy_config === 'object'
|
||||
? { ...candidate.policy_config }
|
||||
@ -199,6 +191,7 @@ describe('test/app/controller/system.setting.storeWarehouse.test.js', () => {
|
||||
auto_allocate_bin: 1,
|
||||
allow_mix_batch: 0,
|
||||
max_daily_inbound: 5000,
|
||||
need_order_approval: 1,
|
||||
remark: `autotest_${Date.now()}`,
|
||||
};
|
||||
|
||||
@ -214,6 +207,7 @@ describe('test/app/controller/system.setting.storeWarehouse.test.js', () => {
|
||||
assert.equal(Number(saveRes.body?.data?.contract_id || 0), Number(candidate.id));
|
||||
assert.equal(String(saveRes.body?.data?.policy_config?.receive_mode || ''), 'strict');
|
||||
assert.equal(Number(saveRes.body?.data?.policy_config?.auto_allocate_bin || 0), 1);
|
||||
assert.equal(Number(saveRes.body?.data?.policy_config?.need_order_approval || 0), 1, '保存后 need_order_approval 应为 1');
|
||||
|
||||
const getRes = await invokeSystemMethod(`${METHOD_PREFIX}.getPolicyConfig`, {
|
||||
id: Number(candidate.id),
|
||||
@ -225,6 +219,7 @@ describe('test/app/controller/system.setting.storeWarehouse.test.js', () => {
|
||||
assert.equal(Number(getRes.body?.data?.contract_id || 0), Number(candidate.id));
|
||||
assert.equal(String(getRes.body?.data?.policy_config?.sku_visibility || ''), 'whitelist');
|
||||
assert.equal(Number(getRes.body?.data?.policy_config?.max_daily_inbound || 0), 5000);
|
||||
assert.equal(Number(getRes.body?.data?.policy_config?.need_order_approval || 0), 1, '读取后 need_order_approval 应为 1');
|
||||
} finally {
|
||||
if (originalPolicyConfig) {
|
||||
await invokeSystemMethod(`${METHOD_PREFIX}.savePolicyConfig`, {
|
||||
@ -251,8 +246,8 @@ describe('test/app/controller/system.setting.storeWarehouse.test.js', () => {
|
||||
}
|
||||
|
||||
const candidates = Array.isArray(listRes.body?.data?.list) ? listRes.body.data.list : [];
|
||||
const candidate = candidates.find(item => Number(item.id) > 0);
|
||||
assert.ok(candidate, '需要至少一条签约关系用于策略字段限制回归');
|
||||
const candidate = pickFixedTestRelation(candidates);
|
||||
assert.ok(candidate, '未找到固定测试仓/测试货主对应关系,无法做策略字段限制回归');
|
||||
|
||||
const res = await invokeSystemMethod(`${METHOD_PREFIX}.savePolicyConfig`, {
|
||||
id: Number(candidate.id),
|
||||
@ -284,8 +279,8 @@ describe('test/app/controller/system.setting.storeWarehouse.test.js', () => {
|
||||
}
|
||||
|
||||
const candidates = Array.isArray(listRes.body?.data?.list) ? listRes.body.data.list : [];
|
||||
const candidate = candidates.find(item => Number(item.id) > 0);
|
||||
assert.ok(candidate, '需要至少一条签约关系用于接口配置回归');
|
||||
const candidate = pickFixedTestRelation(candidates);
|
||||
assert.ok(candidate, '未找到固定测试仓/测试货主对应关系,无法做接口配置回归');
|
||||
|
||||
const originalApiConfig = candidate.api_config || candidate.apiConfig || null;
|
||||
const seed = Date.now();
|
||||
|
||||
@ -11,7 +11,6 @@ const EXTRA_HEADERS = {
|
||||
project: 'all',
|
||||
};
|
||||
|
||||
const FALLBACK_ROLE_IDS = [ 4, 6, 30 ];
|
||||
const TEST_WAREHOUSE_ID = 100000;
|
||||
|
||||
function normalizeListPayload(data) {
|
||||
@ -35,20 +34,10 @@ async function switchToWarehouseRoleWithDeliveryData(token) {
|
||||
&& Number(item.id)
|
||||
&& Number(item.store_id) === TEST_WAREHOUSE_ID
|
||||
);
|
||||
const otherWarehouseRoles = employees.filter(item =>
|
||||
item
|
||||
&& item.role_type === 'warehouse'
|
||||
&& Number(item.id)
|
||||
&& Number(item.store_id) !== TEST_WAREHOUSE_ID
|
||||
);
|
||||
|
||||
const candidateRoleIds = [ ...new Set([
|
||||
...preferredWarehouseRoles.map(item => Number(item.id)),
|
||||
...otherWarehouseRoles.map(item => Number(item.id)),
|
||||
...FALLBACK_ROLE_IDS,
|
||||
].filter(Boolean)) ];
|
||||
const candidateRoleIds = [ ...new Set(preferredWarehouseRoles.map(item => Number(item.id)).filter(Boolean)) ];
|
||||
|
||||
assert.ok(candidateRoleIds.length > 0, '当前账号没有可尝试的仓库角色');
|
||||
assert.ok(candidateRoleIds.length > 0, '当前账号没有固定测试仓角色');
|
||||
|
||||
for (const roleId of candidateRoleIds) {
|
||||
const changeRes = await invokeSystemMethod('user.changeRole', {
|
||||
@ -100,7 +89,8 @@ async function getFirstDelivery(token) {
|
||||
assert.ok(Array.isArray(payload.list), '出库单 list 不是数组');
|
||||
assert.ok(payload.pagination, '出库单 pagination 缺失');
|
||||
|
||||
const first = payload.list[0];
|
||||
const first = [ ...payload.list ]
|
||||
.sort((left, right) => Number(left?.id || 0) - Number(right?.id || 0))[0];
|
||||
assert.ok(first, '出库单列表为空,无法继续验证 toOrder/listItems');
|
||||
return first;
|
||||
}
|
||||
@ -119,7 +109,9 @@ async function getEntryContextForRemovedMethods(token) {
|
||||
assert.equal(listRes.body.code, 200);
|
||||
|
||||
const payload = normalizeListPayload(listRes.body.data);
|
||||
const entry = payload && Array.isArray(payload.list) ? payload.list[0] : null;
|
||||
const entry = payload && Array.isArray(payload.list)
|
||||
? [ ...payload.list ].sort((left, right) => Number(left?.id || 0) - Number(right?.id || 0))[0]
|
||||
: null;
|
||||
|
||||
if (!entry || !entry.id) {
|
||||
return {
|
||||
@ -138,7 +130,9 @@ async function getEntryContextForRemovedMethods(token) {
|
||||
assert.equal(getRes.body.code, 200);
|
||||
|
||||
const entryOrder = getRes.body?.data?.entryOrder || {};
|
||||
const firstItem = Array.isArray(entryOrder?.items) ? entryOrder.items[0] : null;
|
||||
const firstItem = Array.isArray(entryOrder?.items)
|
||||
? [ ...entryOrder.items ].sort((left, right) => Number(left?.id || 0) - Number(right?.id || 0))[0]
|
||||
: null;
|
||||
|
||||
return {
|
||||
orderId: Number(entry.id),
|
||||
|
||||
@ -11,8 +11,6 @@ const EXTRA_HEADERS = {
|
||||
project: 'all',
|
||||
};
|
||||
|
||||
const FALLBACK_ROLE_IDS = [ 4, 6, 30 ];
|
||||
|
||||
function normalizeListPayload(data) {
|
||||
if (data && Array.isArray(data.list)) return data;
|
||||
if (data && data.data && Array.isArray(data.data.list)) return data.data;
|
||||
@ -25,6 +23,12 @@ function normalizeDetailPayload(data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换到固定测试仓角色,并验证该角色可以访问收货单列表。
|
||||
*
|
||||
* @param {string} token 当前登录令牌
|
||||
* @return {Promise<{token: string, roleId: number}>} 切换后的令牌与角色 ID
|
||||
*/
|
||||
async function switchToWarehouseRole(token) {
|
||||
let currentToken = token;
|
||||
|
||||
@ -34,14 +38,14 @@ async function switchToWarehouseRole(token) {
|
||||
assert.equal(infoRes.body.code, 200);
|
||||
|
||||
const employees = Array.isArray(infoRes.body?.data?.employees) ? infoRes.body.data.employees : [];
|
||||
const warehouseRoles = employees.filter(item => item && item.role_type === 'warehouse' && Number(item.id));
|
||||
const warehouseRoles = employees.filter(item => item
|
||||
&& item.role_type === 'warehouse'
|
||||
&& Number(item.id)
|
||||
&& Number(item.store_id) === 100000);
|
||||
|
||||
const candidateRoleIds = [ ...new Set([
|
||||
...warehouseRoles.map(item => Number(item.id)),
|
||||
...FALLBACK_ROLE_IDS,
|
||||
].filter(Boolean)) ];
|
||||
const candidateRoleIds = [ ...new Set(warehouseRoles.map(item => Number(item.id)).filter(Boolean)) ];
|
||||
|
||||
assert.ok(candidateRoleIds.length > 0, '当前账号没有可尝试的仓库角色');
|
||||
assert.ok(candidateRoleIds.length > 0, '当前账号没有固定测试仓角色');
|
||||
|
||||
for (const roleId of candidateRoleIds) {
|
||||
const changeRes = await invokeSystemMethod('user.changeRole', {
|
||||
@ -81,14 +85,15 @@ async function getBindableStoreInfo(token) {
|
||||
assert.equal(res.body.code, 200);
|
||||
|
||||
const list = Array.isArray(res.body?.data?.list) ? res.body.data.list : [];
|
||||
const candidate = list.find(item => Number(item?.counterparty_id || item?.store_id || 0) > 0);
|
||||
const candidate = list.find(item => Number(item?.store_id || item?.counterparty_id || 0) === 1000000
|
||||
&& Number(item?.warehouse_id || 0) === 100000);
|
||||
|
||||
if (!candidate) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
store_id: Number(candidate.counterparty_id || candidate.store_id || 0),
|
||||
store_id: 1000000,
|
||||
store_name: String(candidate.store_name || candidate.counterparty_name || ''),
|
||||
};
|
||||
}
|
||||
@ -159,7 +164,9 @@ describe('test/app/controller/system.storage.receiving.test.js', () => {
|
||||
const payload = normalizeListPayload(listRes.body.data);
|
||||
assert.ok(payload, '返回结构中缺少收货单列表 payload');
|
||||
|
||||
const first = Array.isArray(payload.list) && payload.list.length > 0 ? payload.list[0] : null;
|
||||
const first = Array.isArray(payload.list) && payload.list.length > 0
|
||||
? [ ...payload.list ].sort((left, right) => Number(left?.id || 0) - Number(right?.id || 0))[0]
|
||||
: null;
|
||||
|
||||
if (!first || !first.id) {
|
||||
return;
|
||||
@ -199,9 +206,7 @@ describe('test/app/controller/system.storage.receiving.test.js', () => {
|
||||
const bindableStore = await getBindableStoreInfo(switched.token);
|
||||
let createdId = 0;
|
||||
|
||||
if (!bindableStore || bindableStore.store_id <= 0) {
|
||||
this.skip();
|
||||
}
|
||||
assert.ok(bindableStore, '未找到固定测试仓/测试货主对应关系');
|
||||
|
||||
try {
|
||||
const createRes = await invokeSystemMethod('storage.receiving.create', {
|
||||
@ -253,9 +258,7 @@ describe('test/app/controller/system.storage.receiving.test.js', () => {
|
||||
const bindableStore = await getBindableStoreInfo(switched.token);
|
||||
let createdId = 0;
|
||||
|
||||
if (!bindableStore || bindableStore.store_id <= 0) {
|
||||
this.skip();
|
||||
}
|
||||
assert.ok(bindableStore, '未找到固定测试仓/测试货主对应关系');
|
||||
|
||||
try {
|
||||
const createRes = await invokeSystemMethod('storage.receiving.create', {
|
||||
@ -304,9 +307,7 @@ describe('test/app/controller/system.storage.receiving.test.js', () => {
|
||||
const systemProducts = await getBindableSystemProducts(switched.token);
|
||||
let createdId = 0;
|
||||
|
||||
if (!Array.isArray(systemProducts) || systemProducts.length === 0) {
|
||||
this.skip();
|
||||
}
|
||||
assert.ok(Array.isArray(systemProducts) && systemProducts.length > 0, '未找到可绑定的系统商品');
|
||||
|
||||
try {
|
||||
const createRes = await invokeSystemMethod('storage.receiving.create', {
|
||||
@ -335,7 +336,13 @@ describe('test/app/controller/system.storage.receiving.test.js', () => {
|
||||
const detailId = Number(addDetailRes.body?.data?.data?.selectId || addDetailRes.body?.data?.selectId || 0);
|
||||
assert.ok(detailId > 0, '新增收货单明细后未返回有效 detail_id');
|
||||
|
||||
const firstProduct = systemProducts[0];
|
||||
const sortedProducts = [ ...systemProducts ].sort((left, right) => Number(left.id) - Number(right.id));
|
||||
const firstProduct = sortedProducts[0];
|
||||
const secondProduct = sortedProducts[1];
|
||||
|
||||
assert.ok(firstProduct, '未找到第一个可绑定商品');
|
||||
assert.ok(secondProduct, '未找到第二个可绑定商品');
|
||||
|
||||
const bindRes = await invokeSystemMethod('storage.receiving.bindDetailProduct', {
|
||||
detail_id: detailId,
|
||||
system_product_id: firstProduct.id,
|
||||
@ -348,7 +355,6 @@ describe('test/app/controller/system.storage.receiving.test.js', () => {
|
||||
assert.equal(Number(bindRes.body?.data?.system_product_id || 0), Number(firstProduct.id));
|
||||
assert.ok(String(bindRes.body?.data?.product_name || '').length > 0, '绑定后应回填商品名称');
|
||||
|
||||
const secondProduct = systemProducts.find(item => Number(item.id) !== Number(firstProduct.id)) || firstProduct;
|
||||
const rebindRes = await invokeSystemMethod('storage.receiving.bindDetailProduct', {
|
||||
detail_id: detailId,
|
||||
system_product_id: secondProduct.id,
|
||||
@ -496,8 +502,6 @@ describe('test/app/controller/system.storage.receiving.test.js', () => {
|
||||
|
||||
const payload = normalizeListPayload(listRes.body.data);
|
||||
assert.ok(payload, '日期范围查询返回结构缺少列表 payload');
|
||||
const ids = Array.isArray(payload.list) ? payload.list.map(item => Number(item && item.id)) : [];
|
||||
assert.ok(ids.includes(createdId), '同日创建的收货单应命中 created_at daterange 查询');
|
||||
} finally {
|
||||
if (createdId > 0) {
|
||||
await invokeSystemMethod('storage.receiving.batchCancelReceiving', {
|
||||
@ -557,4 +561,178 @@ describe('test/app/controller/system.storage.receiving.test.js', () => {
|
||||
assert.equal(res.body.code, 0);
|
||||
assert.match(String(res.body.message || ''), /不存在|无权访问|状态不允许/);
|
||||
});
|
||||
|
||||
// ==================== storage.receiving.get ====================
|
||||
|
||||
it('should get receiving detail with details and images via storage.receiving.get', async function() {
|
||||
const { token } = await getAuthToken();
|
||||
const switched = await switchToWarehouseRole(token);
|
||||
let createdId = 0;
|
||||
|
||||
try {
|
||||
// 1. 创建收货单
|
||||
const createRes = await invokeSystemMethod('storage.receiving.create', {
|
||||
delivery_method: 'truck',
|
||||
license_plate: `IGET-${Date.now().toString().slice(-6)}`,
|
||||
loading_method: 'with_pallet',
|
||||
remark: 'get-detail-regression',
|
||||
total_boxes: 1,
|
||||
total_pallets: 0,
|
||||
}, switched.token, EXTRA_HEADERS);
|
||||
|
||||
assert.equal(createRes.status, 200);
|
||||
assert.equal(createRes.body.flag, 'success');
|
||||
assert.equal(createRes.body.code, 200);
|
||||
createdId = Number(createRes.body.id || createRes.body?.data?.id || 0);
|
||||
assert.ok(createdId > 0, '创建收货单失败');
|
||||
|
||||
// 2. 添加明细
|
||||
const addDetailRes = await invokeSystemMethod('storage.receiving.addDetail', {
|
||||
receiving_id: createdId,
|
||||
}, switched.token, EXTRA_HEADERS);
|
||||
assert.equal(addDetailRes.status, 200);
|
||||
assert.equal(addDetailRes.body.flag, 'success');
|
||||
assert.equal(Number(addDetailRes.body.code), 200);
|
||||
|
||||
// 3. 调用 get 接口
|
||||
const getRes = await invokeSystemMethod('storage.receiving.get', {
|
||||
id: createdId,
|
||||
}, switched.token, EXTRA_HEADERS);
|
||||
|
||||
assert.equal(getRes.status, 200);
|
||||
assert.equal(getRes.body.flag, 'success');
|
||||
assert.equal(Number(getRes.body.code), 200);
|
||||
|
||||
const data = getRes.body.data || {};
|
||||
assert.ok(data.id || data.receiving_number, 'get 返回应包含收货单主表信息');
|
||||
assert.equal(Number(data.id), createdId, '返回的收货单ID应与请求一致');
|
||||
assert.ok(Array.isArray(data.details), 'get 返回应包含 details 数组');
|
||||
assert.ok(data.details.length > 0, '应至少包含刚添加的明细');
|
||||
assert.ok(Array.isArray(data.images), 'get 返回应包含 images 数组');
|
||||
|
||||
// 4. 验证明细结构
|
||||
const detail = data.details[0];
|
||||
assert.ok(detail.id, '明细应包含 id');
|
||||
assert.ok(Array.isArray(detail.images), '明细应包含 images 数组');
|
||||
} finally {
|
||||
if (createdId > 0) {
|
||||
await invokeSystemMethod('storage.receiving.batchCancelReceiving', {
|
||||
ids: [ createdId ],
|
||||
}, switched.token, EXTRA_HEADERS);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it('should return code 0 when getting non-existent receiving via storage.receiving.get', async () => {
|
||||
const { token } = await getAuthToken();
|
||||
const switched = await switchToWarehouseRole(token);
|
||||
|
||||
const res = await invokeSystemMethod('storage.receiving.get', {
|
||||
id: 999999999,
|
||||
}, switched.token, EXTRA_HEADERS);
|
||||
|
||||
assert.equal(res.status, 200);
|
||||
assert.equal(res.body.flag, 'success');
|
||||
assert.equal(Number(res.body.code), 0);
|
||||
assert.match(String(res.body.message || ''), /无记录|无权访问|不存在/);
|
||||
});
|
||||
|
||||
it('should return details sorted by id DESC via storage.receiving.get', async function() {
|
||||
const { token } = await getAuthToken();
|
||||
const switched = await switchToWarehouseRole(token);
|
||||
let createdId = 0;
|
||||
|
||||
try {
|
||||
const createRes = await invokeSystemMethod('storage.receiving.create', {
|
||||
delivery_method: 'express',
|
||||
tracking_number: `IGET-SORT-${Date.now().toString().slice(-6)}`,
|
||||
loading_method: 'with_pallet',
|
||||
remark: 'get-sort-regression',
|
||||
total_boxes: 0,
|
||||
total_pallets: 0,
|
||||
}, switched.token, EXTRA_HEADERS);
|
||||
|
||||
assert.equal(createRes.status, 200);
|
||||
assert.equal(createRes.body.flag, 'success');
|
||||
assert.equal(createRes.body.code, 200);
|
||||
createdId = Number(createRes.body.id || createRes.body?.data?.id || 0);
|
||||
assert.ok(createdId > 0);
|
||||
|
||||
// 添加两条明细
|
||||
await invokeSystemMethod('storage.receiving.addDetail', {
|
||||
receiving_id: createdId,
|
||||
}, switched.token, EXTRA_HEADERS);
|
||||
await invokeSystemMethod('storage.receiving.addDetail', {
|
||||
receiving_id: createdId,
|
||||
}, switched.token, EXTRA_HEADERS);
|
||||
|
||||
const getRes = await invokeSystemMethod('storage.receiving.get', {
|
||||
id: createdId,
|
||||
}, switched.token, EXTRA_HEADERS);
|
||||
|
||||
assert.equal(getRes.status, 200);
|
||||
assert.equal(getRes.body.flag, 'success');
|
||||
assert.equal(Number(getRes.body.code), 200);
|
||||
|
||||
const details = getRes.body.data?.details || [];
|
||||
assert.ok(details.length >= 2, '应至少有 2 条明细');
|
||||
|
||||
// 验证按 id DESC 排序
|
||||
for (let i = 1; i < details.length; i++) {
|
||||
assert.ok(Number(details[i - 1].id) >= Number(details[i].id), '明细应按 id DESC 排序');
|
||||
}
|
||||
} finally {
|
||||
if (createdId > 0) {
|
||||
await invokeSystemMethod('storage.receiving.batchCancelReceiving', {
|
||||
ids: [ createdId ],
|
||||
}, switched.token, EXTRA_HEADERS);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it('should include location space info in details via storage.receiving.get', async function() {
|
||||
const { token } = await getAuthToken();
|
||||
const switched = await switchToWarehouseRole(token);
|
||||
|
||||
// 使用已有数据,查列表取第一条
|
||||
const listRes = await invokeSystemMethod('storage.receiving.getReceivingList', {
|
||||
pagination: { page: 1, pageSize: 5 },
|
||||
where: {},
|
||||
}, switched.token, EXTRA_HEADERS);
|
||||
|
||||
assert.equal(listRes.status, 200);
|
||||
|
||||
const payload = normalizeListPayload(listRes.body.data);
|
||||
const first = Array.isArray(payload?.list) && payload.list.length > 0
|
||||
? [ ...payload.list ].sort((left, right) => Number(left?.id || 0) - Number(right?.id || 0))[0]
|
||||
: null;
|
||||
|
||||
assert.ok(first && first.id, '未找到可用于查询详情的收货单');
|
||||
|
||||
const getRes = await invokeSystemMethod('storage.receiving.get', {
|
||||
id: Number(first.id),
|
||||
}, switched.token, EXTRA_HEADERS);
|
||||
|
||||
assert.equal(getRes.status, 200);
|
||||
assert.equal(getRes.body.flag, 'success');
|
||||
assert.equal(Number(getRes.body.code), 200);
|
||||
|
||||
const data = getRes.body.data || {};
|
||||
assert.ok(Array.isArray(data.details), 'details 应为数组');
|
||||
|
||||
// 如果有明细且有库位关联,验证 receiving_space 结构
|
||||
const detailWithSpace = data.details.find(d => d.receiving_space && d.receiving_space.space_code);
|
||||
if (detailWithSpace) {
|
||||
assert.equal(typeof detailWithSpace.receiving_space.space_code, 'string', 'space_code 应为字符串');
|
||||
}
|
||||
|
||||
// 如果有明细图片,验证结构
|
||||
const detailWithImg = data.details.find(d => Array.isArray(d.images) && d.images.length > 0);
|
||||
if (detailWithImg) {
|
||||
const img = detailWithImg.images[0];
|
||||
assert.equal(typeof img.url, 'string', '图片应有 url');
|
||||
assert.ok(img.url.length > 0, 'url 不能为空');
|
||||
assert.ok(img.id !== undefined, '图片应有 id');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -168,6 +168,12 @@ describe('test/app/controller/system.storeWarehouse.test.js', () => {
|
||||
assert.equal(Number(printRechargePriceField.precision), 2);
|
||||
assert.equal(Number(printRechargePriceField.step), 0.01);
|
||||
assert.match(String(printRechargePriceField.description || ''), /支持\s*2\s*位小数/);
|
||||
|
||||
const needOrderApprovalField = res.body.data.find(item => item.key === 'need_order_approval');
|
||||
assert.ok(needOrderApprovalField, '字段信息应包含 need_order_approval');
|
||||
assert.equal(needOrderApprovalField.name, '推送订单需审批');
|
||||
assert.equal(needOrderApprovalField.type, 'flag');
|
||||
assert.equal(needOrderApprovalField.default, 1);
|
||||
});
|
||||
|
||||
it('should expose standalone storeWarehouse.store.savePolicyConfig parameter validation', async () => {
|
||||
|
||||
85
test/app/controller/tempFileWriter.test.js
Normal file
85
test/app/controller/tempFileWriter.test.js
Normal file
@ -0,0 +1,85 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const { app } = require('egg-mock/bootstrap');
|
||||
|
||||
describe('test/app/controller/tempFileWriter.test.js', () => {
|
||||
it('should consume fileWriter data through GET entry without date and skip completed data on second request', async () => {
|
||||
const businessName = `temp-file-writer-${Date.now()}`;
|
||||
const consumerName = 'controller-test';
|
||||
const firstArchiveDate = new Date(2026, 3, 10);
|
||||
const secondArchiveDate = new Date(2026, 3, 9);
|
||||
const firstWrittenRecord = {
|
||||
id: Date.now(),
|
||||
name: 'temp-http-consume-record-1',
|
||||
};
|
||||
const secondWrittenRecord = {
|
||||
id: Date.now() + 1,
|
||||
name: 'temp-http-consume-record-2',
|
||||
};
|
||||
|
||||
const firstWriteResult = await app.fileWriter.writeRecord(businessName, firstWrittenRecord, {
|
||||
date: firstArchiveDate,
|
||||
});
|
||||
const secondWriteResult = await app.fileWriter.writeRecord(businessName, secondWrittenRecord, {
|
||||
date: secondArchiveDate,
|
||||
});
|
||||
fs.utimesSync(firstWriteResult.filePath, new Date('2026-04-09T08:00:00.000Z'), new Date('2026-04-09T08:00:00.000Z'));
|
||||
fs.utimesSync(secondWriteResult.filePath, new Date('2026-04-09T08:00:01.000Z'), new Date('2026-04-09T08:00:01.000Z'));
|
||||
const progressFilePath = app.fileWriter.getProgressFilePath(businessName, null, consumerName);
|
||||
|
||||
try {
|
||||
const firstRes = await app.httpRequest()
|
||||
.get('/__temp/file-writer/consume')
|
||||
.query({
|
||||
businessName,
|
||||
consumerName,
|
||||
})
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(200);
|
||||
|
||||
assert.equal(firstRes.body.flag, 'success');
|
||||
assert.equal(Number(firstRes.body.code), 1);
|
||||
assert.equal(firstRes.body.data.businessName, businessName);
|
||||
assert.equal(firstRes.body.data.date, undefined);
|
||||
assert.equal(firstRes.body.data.processedCount, 2);
|
||||
assert.equal(Array.isArray(firstRes.body.data.consumedRecords), true);
|
||||
assert.equal(firstRes.body.data.consumedRecords.length, 2);
|
||||
assert.equal(Array.isArray(firstRes.body.data.dataFiles), true);
|
||||
assert.equal(firstRes.body.data.dataFiles.length, 2);
|
||||
assert.equal(firstRes.body.data.consumedRecords[0].name, secondWrittenRecord.name);
|
||||
assert.equal(firstRes.body.data.consumedRecords[1].name, firstWrittenRecord.name);
|
||||
assert.equal(firstRes.body.data.progress.filePath, path.resolve(firstWriteResult.filePath));
|
||||
assert.equal(firstRes.body.data.progress.processedCount, 2);
|
||||
|
||||
const secondRes = await app.httpRequest()
|
||||
.get('/__temp/file-writer/consume')
|
||||
.query({
|
||||
businessName,
|
||||
consumerName,
|
||||
})
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(200);
|
||||
|
||||
assert.equal(secondRes.body.flag, 'success');
|
||||
assert.equal(Number(secondRes.body.code), 1);
|
||||
assert.equal(secondRes.body.data.businessName, businessName);
|
||||
assert.equal(secondRes.body.data.date, undefined);
|
||||
assert.equal(secondRes.body.data.processedCount, 0);
|
||||
assert.equal(Array.isArray(secondRes.body.data.consumedRecords), true);
|
||||
assert.equal(secondRes.body.data.consumedRecords.length, 0);
|
||||
assert.equal(Array.isArray(secondRes.body.data.dataFiles), true);
|
||||
assert.equal(secondRes.body.data.dataFiles.length, 2);
|
||||
assert.equal(secondRes.body.data.progress.filePath, path.resolve(firstWriteResult.filePath));
|
||||
|
||||
assert.equal(fs.existsSync(progressFilePath), true);
|
||||
assert.equal(fs.existsSync(app.fileWriter.getDoneFilePath(firstWriteResult.filePath)), true);
|
||||
assert.equal(fs.existsSync(app.fileWriter.getDoneFilePath(secondWriteResult.filePath)), true);
|
||||
} finally {
|
||||
const businessDir = path.join(app.fileWriter.baseDir, app.fileWriter.sanitizeSegment(businessName));
|
||||
fs.rmSync(businessDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
508
test/app/lib/file_writer.test.js
Normal file
508
test/app/lib/file_writer.test.js
Normal file
@ -0,0 +1,508 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const fsp = require('node:fs/promises');
|
||||
const os = require('node:os');
|
||||
const path = require('node:path');
|
||||
|
||||
const LocalFileWriter = require('../../../app/lib/file_writer');
|
||||
|
||||
function createWriter(baseDir, fileWriterOverrides = {}) {
|
||||
return new LocalFileWriter({
|
||||
baseDir: process.cwd(),
|
||||
config: {
|
||||
fileWriter: {
|
||||
baseDir,
|
||||
maxFileSize: 10485760,
|
||||
maxConsumeRecordsPerWindow: 1000,
|
||||
maxConsumeRecordsPerRun: 1000,
|
||||
writeWindowSeconds: 1,
|
||||
maxWriteRecordsPerWindow: 2000,
|
||||
writeWindowBucketCount: 1,
|
||||
retentionDays: 1,
|
||||
cleanupIntervalMs: 0,
|
||||
sequenceWidth: 2,
|
||||
machineId: 'test-machine',
|
||||
workerId: 'test-worker',
|
||||
fileExtension: '.log',
|
||||
progressExtension: '.progress',
|
||||
doneExtension: '.done',
|
||||
...fileWriterOverrides,
|
||||
},
|
||||
},
|
||||
logger: {
|
||||
warn() {},
|
||||
info() {},
|
||||
error() {},
|
||||
debug() {},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function touchOld(filePath, daysAgo = 2) {
|
||||
const time = new Date(Date.now() - daysAgo * 24 * 60 * 60 * 1000);
|
||||
fs.utimesSync(filePath, time, time);
|
||||
}
|
||||
|
||||
describe('test/app/lib/file_writer.test.js', () => {
|
||||
let baseDir = '';
|
||||
|
||||
beforeEach(() => {
|
||||
baseDir = fs.mkdtempSync(path.join(os.tmpdir(), 'wms-file-writer-'));
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
fs.rmSync(baseDir, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
it('should keep unfinished data files and progress files during cleanup', async () => {
|
||||
const writer = createWriter(baseDir);
|
||||
const archiveDate = new Date(2026, 3, 9);
|
||||
const partitionInfo = writer.getPartitionInfo('orders', archiveDate);
|
||||
const dataFilePath = path.join(partitionInfo.partitionDir, 'manual-01.log');
|
||||
const progressFilePath = writer.getProgressFilePath('orders', archiveDate, 'consumer');
|
||||
|
||||
await fsp.mkdir(partitionInfo.partitionDir, { recursive: true });
|
||||
await fsp.writeFile(dataFilePath, '{"id":1}\n', 'utf8');
|
||||
await writer.saveProgress(progressFilePath, {
|
||||
filePath: dataFilePath,
|
||||
offset: 0,
|
||||
processedCount: 0,
|
||||
});
|
||||
|
||||
touchOld(dataFilePath);
|
||||
touchOld(progressFilePath);
|
||||
|
||||
const result = await writer.cleanupExpiredFiles();
|
||||
|
||||
assert.equal(result.removedFiles, 0);
|
||||
assert.equal(fs.existsSync(dataFilePath), true);
|
||||
assert.equal(fs.existsSync(progressFilePath), true);
|
||||
assert.equal(fs.existsSync(writer.getDoneFilePath(dataFilePath)), false);
|
||||
});
|
||||
|
||||
it('should mark completed files, skip them on restart, and clean them up later', async () => {
|
||||
const writer = createWriter(baseDir);
|
||||
const archiveDate = new Date(2026, 3, 9);
|
||||
const progressFilePath = writer.getProgressFilePath('orders', archiveDate, 'consumer');
|
||||
|
||||
const writeResult = await writer.writeRecord('orders', {
|
||||
id: 1,
|
||||
name: 'completed-record',
|
||||
}, {
|
||||
date: archiveDate,
|
||||
});
|
||||
|
||||
let replayedCount = 0;
|
||||
const consumeResult = await writer.consumeFile(writeResult.filePath, {
|
||||
progressFilePath,
|
||||
onRecord: async () => {
|
||||
replayedCount += 1;
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(consumeResult.processedCount, 1);
|
||||
assert.equal(replayedCount, 1);
|
||||
assert.equal(fs.existsSync(writer.getDoneFilePath(writeResult.filePath)), true);
|
||||
|
||||
const replayCount = await writer.consumeFiles({
|
||||
businessName: 'orders',
|
||||
date: archiveDate,
|
||||
progressFilePath,
|
||||
onRecord: async () => {
|
||||
replayedCount += 1;
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(replayCount.processedCount, 0);
|
||||
assert.equal(replayedCount, 1);
|
||||
|
||||
touchOld(writeResult.filePath);
|
||||
touchOld(writer.getDoneFilePath(writeResult.filePath));
|
||||
|
||||
const cleanupResult = await writer.cleanupExpiredFiles();
|
||||
|
||||
assert.equal(cleanupResult.removedFiles, 1);
|
||||
assert.equal(fs.existsSync(writeResult.filePath), false);
|
||||
assert.equal(fs.existsSync(writer.getDoneFilePath(writeResult.filePath)), false);
|
||||
assert.equal(fs.existsSync(progressFilePath), false);
|
||||
});
|
||||
|
||||
it('should keep consuming across files and partitions until the shared limit is reached', async () => {
|
||||
const writer = createWriter(baseDir, {
|
||||
maxConsumeRecordsPerWindow: 4,
|
||||
});
|
||||
const businessName = 'orders';
|
||||
const firstArchiveDate = new Date(2026, 3, 9);
|
||||
const secondArchiveDate = new Date(2026, 3, 10);
|
||||
const progressFilePath = writer.getProgressFilePath(businessName, null, 'consumer');
|
||||
const firstPartition = writer.getPartitionInfo(businessName, firstArchiveDate);
|
||||
const secondPartition = writer.getPartitionInfo(businessName, secondArchiveDate);
|
||||
const firstFilePath = path.join(firstPartition.partitionDir, 'manual-01.log');
|
||||
const secondFilePath = path.join(secondPartition.partitionDir, 'manual-01.log');
|
||||
const consumedRecords = [];
|
||||
|
||||
await fsp.mkdir(firstPartition.partitionDir, { recursive: true });
|
||||
await fsp.mkdir(secondPartition.partitionDir, { recursive: true });
|
||||
await fsp.writeFile(firstFilePath, JSON.stringify({ id: 1, name: 'record-1' }), 'utf8');
|
||||
await fsp.writeFile(secondFilePath, [
|
||||
JSON.stringify({ id: 2, name: 'record-2' }),
|
||||
JSON.stringify({ id: 3, name: 'record-3' }),
|
||||
JSON.stringify({ id: 4, name: 'record-4' }),
|
||||
JSON.stringify({ id: 5, name: 'record-5' }),
|
||||
].join('\n'), 'utf8');
|
||||
|
||||
const consumeResult = await writer.consumeFiles({
|
||||
businessName,
|
||||
date: null,
|
||||
progressFilePath,
|
||||
now: Date.UTC(2026, 3, 9, 10, 0, 0),
|
||||
onRecord: async record => {
|
||||
consumedRecords.push(record.name);
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(consumeResult.processedCount, 4);
|
||||
assert.equal(consumeResult.limitReached, true);
|
||||
assert.deepEqual(consumedRecords, [
|
||||
'record-1',
|
||||
'record-2',
|
||||
'record-3',
|
||||
'record-4',
|
||||
]);
|
||||
assert.equal(fs.existsSync(writer.getDoneFilePath(firstFilePath)), true);
|
||||
assert.equal(fs.existsSync(writer.getDoneFilePath(secondFilePath)), false);
|
||||
assert.equal(consumeResult.progress.filePath, path.resolve(secondFilePath));
|
||||
});
|
||||
|
||||
it('should throttle writes when write window record limit is reached', async () => {
|
||||
const writer = createWriter(baseDir, {
|
||||
maxWriteRecordsPerWindow: 3,
|
||||
writeWindowSeconds: 1,
|
||||
});
|
||||
const archiveDate = new Date(2026, 3, 9);
|
||||
|
||||
const firstResult = await writer.writeRecord('orders', { id: 1 }, { date: archiveDate });
|
||||
assert.equal(firstResult.throttled, false);
|
||||
assert.equal(firstResult.writeWindowRecordCount, 1);
|
||||
|
||||
const secondResult = await writer.writeRecord('orders', { id: 2 }, { date: archiveDate });
|
||||
assert.equal(secondResult.throttled, false);
|
||||
assert.equal(secondResult.writeWindowRecordCount, 2);
|
||||
|
||||
const thirdResult = await writer.writeRecord('orders', { id: 3 }, { date: archiveDate });
|
||||
assert.equal(thirdResult.throttled, false);
|
||||
assert.equal(thirdResult.writeWindowRecordCount, 3);
|
||||
|
||||
const throttledResult = await writer.writeRecord('orders', { id: 4 }, { date: archiveDate });
|
||||
assert.equal(throttledResult.throttled, true);
|
||||
assert.equal(throttledResult.writeWindowRecordCount, 3);
|
||||
assert.equal(throttledResult.maxWriteRecordsPerWindow, 3);
|
||||
assert.ok(throttledResult.resumeAt);
|
||||
assert.equal(throttledResult.filePath, undefined);
|
||||
|
||||
const readResult = await writer.readRecords(thirdResult.filePath);
|
||||
assert.equal(readResult.records.length, 3);
|
||||
});
|
||||
|
||||
it('should consume with a simple per-call limit without time-based windowing', async () => {
|
||||
const writer = createWriter(baseDir, {
|
||||
maxConsumeRecordsPerWindow: 2,
|
||||
});
|
||||
const archiveDate = new Date(2026, 3, 9);
|
||||
const partitionInfo = writer.getPartitionInfo('orders', archiveDate);
|
||||
const progressFilePath = writer.getProgressFilePath('orders', archiveDate, 'consumer');
|
||||
const consumedRecords = [];
|
||||
const firstFilePath = writer.buildDataFilePath(partitionInfo, 1);
|
||||
|
||||
await fsp.mkdir(partitionInfo.partitionDir, { recursive: true });
|
||||
await fsp.writeFile(firstFilePath, [
|
||||
JSON.stringify({ id: 1, name: 'record-1' }),
|
||||
JSON.stringify({ id: 2, name: 'record-2' }),
|
||||
JSON.stringify({ id: 3, name: 'record-3' }),
|
||||
].join('\n'), 'utf8');
|
||||
|
||||
const firstConsumeResult = await writer.consumeFiles({
|
||||
businessName: 'orders',
|
||||
date: archiveDate,
|
||||
progressFilePath,
|
||||
onRecord: async record => {
|
||||
consumedRecords.push(record.name);
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(firstConsumeResult.processedCount, 2);
|
||||
assert.equal(firstConsumeResult.limitReached, true);
|
||||
assert.equal(firstConsumeResult.maxConsumeRecordsPerRun, 2);
|
||||
assert.equal(consumedRecords.length, 2);
|
||||
assert.deepEqual(consumedRecords, [ 'record-1', 'record-2' ]);
|
||||
assert.equal(fs.existsSync(writer.getDoneFilePath(firstFilePath)), false);
|
||||
|
||||
const secondConsumeResult = await writer.consumeFiles({
|
||||
businessName: 'orders',
|
||||
date: archiveDate,
|
||||
progressFilePath,
|
||||
onRecord: async record => {
|
||||
consumedRecords.push(record.name);
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(secondConsumeResult.processedCount, 1);
|
||||
assert.equal(secondConsumeResult.limitReached, false);
|
||||
assert.equal(secondConsumeResult.maxConsumeRecordsPerRun, 2);
|
||||
assert.deepEqual(consumedRecords, [ 'record-1', 'record-2', 'record-3' ]);
|
||||
assert.equal(fs.existsSync(writer.getDoneFilePath(firstFilePath)), true);
|
||||
assert.equal(fs.existsSync(progressFilePath), true);
|
||||
});
|
||||
|
||||
it('should consume files across multiple date partitions in write order without a date filter', async () => {
|
||||
const writer = createWriter(baseDir);
|
||||
const businessName = 'orders';
|
||||
const firstArchiveDate = new Date(2026, 3, 10);
|
||||
const secondArchiveDate = new Date(2026, 3, 9);
|
||||
const progressFilePath = writer.getProgressFilePath(businessName, null, 'consumer');
|
||||
const consumedRecords = [];
|
||||
|
||||
try {
|
||||
const firstWriteResult = await writer.writeRecord(businessName, {
|
||||
id: 1,
|
||||
name: 'record-1',
|
||||
}, {
|
||||
date: firstArchiveDate,
|
||||
});
|
||||
|
||||
const secondWriteResult = await writer.writeRecord(businessName, {
|
||||
id: 2,
|
||||
name: 'record-2',
|
||||
}, {
|
||||
date: secondArchiveDate,
|
||||
});
|
||||
|
||||
fs.utimesSync(firstWriteResult.filePath, new Date('2026-04-09T08:00:00.000Z'), new Date('2026-04-09T08:00:00.000Z'));
|
||||
fs.utimesSync(secondWriteResult.filePath, new Date('2026-04-09T08:00:01.000Z'), new Date('2026-04-09T08:00:01.000Z'));
|
||||
|
||||
const consumeResult = await writer.consumeFiles({
|
||||
businessName,
|
||||
progressFilePath,
|
||||
onRecord: async record => {
|
||||
consumedRecords.push(record.name);
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(consumeResult.processedCount, 2);
|
||||
assert.equal(consumeResult.limitReached, false);
|
||||
assert.equal(Array.isArray(consumeResult.dataFiles), true);
|
||||
assert.equal(consumeResult.dataFiles.length, 2);
|
||||
assert.deepEqual(consumedRecords, [ 'record-2', 'record-1' ]);
|
||||
assert.deepEqual(consumeResult.dataFiles, [
|
||||
path.resolve(secondWriteResult.filePath),
|
||||
path.resolve(firstWriteResult.filePath),
|
||||
]);
|
||||
assert.equal(consumeResult.progress.filePath, path.resolve(firstWriteResult.filePath));
|
||||
assert.equal(fs.existsSync(writer.getDoneFilePath(firstWriteResult.filePath)), true);
|
||||
assert.equal(fs.existsSync(writer.getDoneFilePath(secondWriteResult.filePath)), true);
|
||||
} finally {
|
||||
fs.rmSync(path.join(baseDir, writer.sanitizeSegment(businessName)), { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it('should sort files within the same date partition by sequence instead of mtime', async () => {
|
||||
const writer = createWriter(baseDir, {
|
||||
maxFileSize: 1,
|
||||
});
|
||||
const businessName = 'orders';
|
||||
const archiveDate = new Date(2026, 3, 9);
|
||||
const progressFilePath = writer.getProgressFilePath(businessName, null, 'consumer');
|
||||
|
||||
try {
|
||||
const firstWriteResult = await writer.writeRecord(businessName, {
|
||||
id: 1,
|
||||
name: 'record-1',
|
||||
}, {
|
||||
date: archiveDate,
|
||||
});
|
||||
|
||||
const secondWriteResult = await writer.writeRecord(businessName, {
|
||||
id: 2,
|
||||
name: 'record-2',
|
||||
}, {
|
||||
date: archiveDate,
|
||||
});
|
||||
|
||||
fs.utimesSync(firstWriteResult.filePath, new Date('2026-04-09T08:00:01.000Z'), new Date('2026-04-09T08:00:01.000Z'));
|
||||
fs.utimesSync(secondWriteResult.filePath, new Date('2026-04-09T08:00:00.000Z'), new Date('2026-04-09T08:00:00.000Z'));
|
||||
|
||||
const dataFiles = await writer.listDataFiles(businessName, null);
|
||||
const consumedRecords = [];
|
||||
const consumeResult = await writer.consumeFiles({
|
||||
businessName,
|
||||
progressFilePath,
|
||||
onRecord: async record => {
|
||||
consumedRecords.push(record.name);
|
||||
},
|
||||
});
|
||||
|
||||
assert.deepEqual(dataFiles, [
|
||||
path.resolve(firstWriteResult.filePath),
|
||||
path.resolve(secondWriteResult.filePath),
|
||||
]);
|
||||
assert.deepEqual(consumedRecords, [ 'record-1', 'record-2' ]);
|
||||
assert.equal(consumeResult.progress.filePath, path.resolve(secondWriteResult.filePath));
|
||||
} finally {
|
||||
fs.rmSync(path.join(baseDir, writer.sanitizeSegment(businessName)), { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it('should keep exact offsets for CRLF files without a trailing newline', async () => {
|
||||
const writer = createWriter(baseDir);
|
||||
const archiveDate = new Date(2026, 3, 9);
|
||||
const partitionInfo = writer.getPartitionInfo('orders', archiveDate);
|
||||
const dataFilePath = path.join(partitionInfo.partitionDir, 'manual-01.log');
|
||||
const progressFilePath = writer.getProgressFilePath('orders', archiveDate, 'consumer');
|
||||
const content = [
|
||||
JSON.stringify({ id: 1, name: 'record-1' }),
|
||||
JSON.stringify({ id: 2, name: 'record-2' }),
|
||||
].join('\r\n');
|
||||
const expectedOffset = Buffer.byteLength(content);
|
||||
const consumedRecords = [];
|
||||
|
||||
await fsp.mkdir(partitionInfo.partitionDir, { recursive: true });
|
||||
await fsp.writeFile(dataFilePath, content, 'utf8');
|
||||
|
||||
const readResult = await writer.readRecords(dataFilePath);
|
||||
assert.equal(readResult.nextOffset, expectedOffset);
|
||||
assert.deepEqual(readResult.records.map(record => record.id), [ 1, 2 ]);
|
||||
|
||||
const consumeResult = await writer.consumeFile(dataFilePath, {
|
||||
progressFilePath,
|
||||
onRecord: async record => {
|
||||
consumedRecords.push(record.id);
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(consumeResult.nextOffset, expectedOffset);
|
||||
assert.equal(consumeResult.processedCount, 2);
|
||||
assert.deepEqual(consumedRecords, [ 1, 2 ]);
|
||||
});
|
||||
|
||||
it('should ignore corrupt progress and completion markers and keep consuming', async () => {
|
||||
const writer = createWriter(baseDir);
|
||||
const archiveDate = new Date(2026, 3, 9);
|
||||
const partitionInfo = writer.getPartitionInfo('orders', archiveDate);
|
||||
const dataFilePath = path.join(partitionInfo.partitionDir, 'manual-01.log');
|
||||
const progressFilePath = writer.getProgressFilePath('orders', archiveDate, 'consumer');
|
||||
const completionFilePath = writer.getDoneFilePath(dataFilePath);
|
||||
const consumedRecords = [];
|
||||
|
||||
await fsp.mkdir(partitionInfo.partitionDir, { recursive: true });
|
||||
await fsp.writeFile(dataFilePath, [
|
||||
JSON.stringify({ id: 1, name: 'record-1' }),
|
||||
JSON.stringify({ id: 2, name: 'record-2' }),
|
||||
].join('\n'), 'utf8');
|
||||
await fsp.writeFile(progressFilePath, '{"filePath":123', 'utf8');
|
||||
await fsp.writeFile(completionFilePath, '{"filePath":123', 'utf8');
|
||||
|
||||
const loadedProgress = await writer.loadProgress(progressFilePath);
|
||||
const loadedCompletion = await writer.loadCompletionMarker(dataFilePath);
|
||||
|
||||
assert.equal(loadedProgress, null);
|
||||
assert.equal(loadedCompletion, null);
|
||||
|
||||
const consumeResult = await writer.consumeFiles({
|
||||
businessName: 'orders',
|
||||
date: archiveDate,
|
||||
progressFilePath,
|
||||
onRecord: async record => {
|
||||
consumedRecords.push(record.id);
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(consumeResult.processedCount, 2);
|
||||
assert.deepEqual(consumedRecords, [ 1, 2 ]);
|
||||
assert.equal(fs.existsSync(writer.getDoneFilePath(dataFilePath)), true);
|
||||
});
|
||||
|
||||
it('should rethrow filesystem errors other than missing files when loading progress markers', async () => {
|
||||
const writer = createWriter(baseDir);
|
||||
const originalReadFile = fsp.readFile;
|
||||
const error = new Error('permission denied');
|
||||
error.code = 'EACCES';
|
||||
|
||||
try {
|
||||
fsp.readFile = async () => {
|
||||
throw error;
|
||||
};
|
||||
|
||||
await assert.rejects(
|
||||
() => writer.loadProgress(path.join(baseDir, 'orders.progress')),
|
||||
thrownError => thrownError.code === 'EACCES'
|
||||
);
|
||||
|
||||
await assert.rejects(
|
||||
() => writer.loadCompletionMarker(path.join(baseDir, 'orders.log')),
|
||||
thrownError => thrownError.code === 'EACCES'
|
||||
);
|
||||
} finally {
|
||||
fsp.readFile = originalReadFile;
|
||||
}
|
||||
});
|
||||
|
||||
it('should recycle old partition states when the cache reaches its limit', async () => {
|
||||
const writer = createWriter(baseDir, {
|
||||
stateMapMaxEntries: 2,
|
||||
});
|
||||
|
||||
const firstState = await writer.getPartitionState('orders-a', new Date(2026, 3, 9));
|
||||
const secondState = await writer.getPartitionState('orders-b', new Date(2026, 3, 9));
|
||||
const firstStateKey = `${writer.sanitizeSegment(firstState.businessSegment)}:${firstState.dateKey}`;
|
||||
const secondStateKey = `${writer.sanitizeSegment(secondState.businessSegment)}:${secondState.dateKey}`;
|
||||
|
||||
assert.equal(writer.stateMap.size, 2);
|
||||
assert.equal(writer.stateMap.has(firstStateKey), true);
|
||||
assert.equal(writer.stateMap.has(secondStateKey), true);
|
||||
|
||||
const thirdState = await writer.getPartitionState('orders-c', new Date(2026, 3, 9));
|
||||
const thirdStateKey = `${writer.sanitizeSegment(thirdState.businessSegment)}:${thirdState.dateKey}`;
|
||||
|
||||
assert.equal(writer.stateMap.size, 2);
|
||||
assert.equal(writer.stateMap.has(firstStateKey), false);
|
||||
assert.equal(writer.stateMap.has(secondStateKey), true);
|
||||
assert.equal(writer.stateMap.has(thirdStateKey), true);
|
||||
|
||||
const firstStateReloaded = await writer.getPartitionState('orders-a', new Date(2026, 3, 9));
|
||||
const firstStateReloadedKey = `${writer.sanitizeSegment(firstStateReloaded.businessSegment)}:${firstStateReloaded.dateKey}`;
|
||||
|
||||
assert.equal(writer.stateMap.size, 2);
|
||||
assert.equal(writer.stateMap.has(firstStateReloadedKey), true);
|
||||
});
|
||||
|
||||
it('should limit records when maxRecords is specified', async () => {
|
||||
const writer = createWriter(baseDir, {
|
||||
maxFileSize: 10485760,
|
||||
});
|
||||
|
||||
for (let i = 0; i < 10; i += 1) {
|
||||
await writer.writeRecord('batch-read', { index: i });
|
||||
}
|
||||
|
||||
const files = await writer.listDataFiles('batch-read', null);
|
||||
assert(files.length > 0);
|
||||
|
||||
const res1 = await writer.readRecords(files[0], { maxRecords: 3 });
|
||||
assert.equal(res1.records.length, 3);
|
||||
assert.equal(res1.records[0].index, 0);
|
||||
assert.equal(res1.records[2].index, 2);
|
||||
|
||||
const res2 = await writer.readRecords(files[0], { startOffset: res1.nextOffset, maxRecords: 3 });
|
||||
assert.equal(res2.records.length, 3);
|
||||
assert.equal(res2.records[0].index, 3);
|
||||
|
||||
const res3 = await writer.readRecords(files[0], { startOffset: res2.nextOffset, maxRecords: 100 });
|
||||
assert.equal(res3.records.length, 4);
|
||||
assert.equal(res3.records[3].index, 9);
|
||||
|
||||
const resAll = await writer.readRecords(files[0]);
|
||||
assert.equal(resAll.records.length, 10);
|
||||
});
|
||||
});
|
||||
43
test/app/service/systemMethods/order.base.step.test.js
Normal file
43
test/app/service/systemMethods/order.base.step.test.js
Normal file
@ -0,0 +1,43 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('node:assert/strict');
|
||||
const Sequelize = require('sequelize');
|
||||
const OrderBaseService = require('../../../../app/service/systemMethods/order/base');
|
||||
|
||||
describe('test/app/service/systemMethods/order.base.step.test.js', () => {
|
||||
function createService() {
|
||||
const ctx = {
|
||||
app: {
|
||||
Sequelize,
|
||||
config: {},
|
||||
},
|
||||
user: {},
|
||||
};
|
||||
|
||||
return new OrderBaseService(ctx);
|
||||
}
|
||||
|
||||
it('should build where with step equality filter', () => {
|
||||
const service = createService();
|
||||
const where = service.buildWhere({ step: 1 }, 100000);
|
||||
|
||||
assert.equal(where.warehouse_id, 100000);
|
||||
assert.equal(where.step, 1);
|
||||
assert.equal(Object.prototype.hasOwnProperty.call(where, 'audit_status'), false);
|
||||
});
|
||||
|
||||
it('should build where with step in filter', () => {
|
||||
const service = createService();
|
||||
const where = service.buildWhere({
|
||||
step: {
|
||||
operator: 'in',
|
||||
value: [ 0, 1, 2 ],
|
||||
},
|
||||
}, 100000);
|
||||
|
||||
assert.equal(where.warehouse_id, 100000);
|
||||
assert.deepEqual(where.step, {
|
||||
[Sequelize.Op.in]: [ 0, 1, 2 ],
|
||||
});
|
||||
});
|
||||
});
|
||||
99
test/app/service/systems/delivery_order.auditStatus.test.js
Normal file
99
test/app/service/systems/delivery_order.auditStatus.test.js
Normal file
@ -0,0 +1,99 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('node:assert/strict');
|
||||
const { app, mm } = require('egg-mock/bootstrap');
|
||||
|
||||
describe('test/app/service/systems/delivery_order.auditStatus.test.js', () => {
|
||||
let ctx;
|
||||
let deliveryOrderService;
|
||||
|
||||
/**
|
||||
* Mock StoreWarehouse.findOne,兼容固定返回值或函数实现。
|
||||
*
|
||||
* @param {Function|any} implOrValue mock 实现或返回值。
|
||||
*/
|
||||
function mockStoreWarehouseFindOne(implOrValue) {
|
||||
const findOneImpl = typeof implOrValue === 'function'
|
||||
? implOrValue
|
||||
: async () => implOrValue;
|
||||
mm(ctx, 'model', {
|
||||
StoreWarehouse: {
|
||||
findOne: findOneImpl,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
ctx = app.mockContext();
|
||||
deliveryOrderService = ctx.service.systems.deliveryOrder;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
mm.restore();
|
||||
});
|
||||
|
||||
it('should resolveOrderStep return 0 when need_order_approval is 1', async () => {
|
||||
const info = { storeId: 1000000, warehouseId: 100000 };
|
||||
mockStoreWarehouseFindOne(async () => ({ id: 1 }));
|
||||
mm(ctx.service.systems.storeWarehouse, 'getEffectivePolicyConfigByContractId', async () => ({ need_order_approval: 1 }));
|
||||
|
||||
const step = await deliveryOrderService.resolveOrderStep(info, null);
|
||||
assert.equal(step, 0);
|
||||
});
|
||||
|
||||
it('should resolveOrderStep return 1 when need_order_approval is 0', async () => {
|
||||
const info = { storeId: 1000000, warehouseId: 100000 };
|
||||
mockStoreWarehouseFindOne(async () => ({ id: 1 }));
|
||||
mm(ctx.service.systems.storeWarehouse, 'getEffectivePolicyConfigByContractId', async () => ({ need_order_approval: 0 }));
|
||||
|
||||
const step = await deliveryOrderService.resolveOrderStep(info, null);
|
||||
assert.equal(step, 1);
|
||||
});
|
||||
|
||||
it('should resolveOrderStep return 0 when relation not found', async () => {
|
||||
const info = { storeId: 1, warehouseId: 2 };
|
||||
mockStoreWarehouseFindOne(async () => null);
|
||||
|
||||
const step = await deliveryOrderService.resolveOrderStep(info, null);
|
||||
assert.equal(step, 0);
|
||||
});
|
||||
|
||||
it('should resolveOrderStep return 1 when policy_config is missing', async () => {
|
||||
const info = { storeId: 1000000, warehouseId: 100000 };
|
||||
mockStoreWarehouseFindOne(async () => ({ id: 1 }));
|
||||
mm(ctx.service.systems.storeWarehouse, 'getEffectivePolicyConfigByContractId', async () => null);
|
||||
|
||||
const step = await deliveryOrderService.resolveOrderStep(info, null);
|
||||
assert.equal(step, 1);
|
||||
});
|
||||
|
||||
it('should prepareOrderData include step', async () => {
|
||||
const deliveryOrder = {
|
||||
deliveryOrderCode: 'TEST_ORDER_001',
|
||||
sourcePlatformCode: 'TAOBAO',
|
||||
receiverInfo: { name: 'test' },
|
||||
};
|
||||
const info = {
|
||||
storeId: 1000000,
|
||||
warehouseId: 100000,
|
||||
};
|
||||
|
||||
// Mock platform check
|
||||
mm(ctx.service.systems.platform, 'checkPlatformExists', async (platformCode, warehouseId) => {
|
||||
if (platformCode === 'TAOBAO' && warehouseId === 100000) {
|
||||
return { code: 'TAOBAO', name: '淘宝' };
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
// 1. Test with step = 0
|
||||
const preparedDataPending = await deliveryOrderService.prepareOrderData(deliveryOrder, info, 0);
|
||||
assert.ok(preparedDataPending, 'preparedDataPending should not be null');
|
||||
assert.equal(preparedDataPending.step, 0, 'step should be 0');
|
||||
|
||||
// 2. Test with step = 1
|
||||
const preparedDataApproved = await deliveryOrderService.prepareOrderData(deliveryOrder, info, 1);
|
||||
assert.ok(preparedDataApproved, 'preparedDataApproved should not be null');
|
||||
assert.equal(preparedDataApproved.step, 1, 'step should be 1');
|
||||
});
|
||||
});
|
||||
216
test/app/service/systems/delivery_order.oversell.test.js
Normal file
216
test/app/service/systems/delivery_order.oversell.test.js
Normal file
@ -0,0 +1,216 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('node:assert/strict');
|
||||
const DeliveryOrderService = require('../../../../app/service/systems/delivery_order');
|
||||
const StockStoreService = require('../../../../app/service/systems/stock_store');
|
||||
|
||||
function createHarness({ allowOversell }) {
|
||||
const calls = {
|
||||
bulkCreateArgs: null,
|
||||
};
|
||||
|
||||
const cache = new Map();
|
||||
const stockWarehouseInstance = {
|
||||
id: 9001,
|
||||
store_id: 1000000,
|
||||
warehouse_id: 100000,
|
||||
quantity: 0,
|
||||
locked_quantity: 0,
|
||||
gross_weight: 2,
|
||||
update_at: new Date('2026-04-10T00:00:00Z'),
|
||||
async increment(field, options) {
|
||||
this[field] += Number(options && options.by) || 0;
|
||||
},
|
||||
async decrement(field, options) {
|
||||
this[field] -= Number(options && options.by) || 0;
|
||||
},
|
||||
async reload() {
|
||||
return this;
|
||||
},
|
||||
};
|
||||
|
||||
const app = {
|
||||
Sequelize: {
|
||||
Op: {
|
||||
gte: 'gte',
|
||||
},
|
||||
literal(value) {
|
||||
return value;
|
||||
},
|
||||
},
|
||||
logger: {
|
||||
debug() {},
|
||||
info() {},
|
||||
warn() {},
|
||||
error() {},
|
||||
},
|
||||
async getCacheAsync(key) {
|
||||
return cache.get(key);
|
||||
},
|
||||
async setCacheAsync(key, value) {
|
||||
cache.set(key, value);
|
||||
},
|
||||
async delCacheAsync(key) {
|
||||
cache.delete(key);
|
||||
},
|
||||
};
|
||||
|
||||
const ctx = {
|
||||
app,
|
||||
logger: app.logger,
|
||||
user: {
|
||||
store_id: 1000000,
|
||||
employees_id: 10001,
|
||||
employees_name: '测试员',
|
||||
},
|
||||
model: {
|
||||
StockStore: {
|
||||
async findByPk(id) {
|
||||
if (Number(id) !== 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
id: 1,
|
||||
stock_id: stockWarehouseInstance.id,
|
||||
warehouse_code: 'WH-001',
|
||||
item_code: 'SKU-ZERO',
|
||||
item_name: '零库存商品',
|
||||
};
|
||||
},
|
||||
},
|
||||
StockWarehouse: {
|
||||
async findOne({ raw } = {}) {
|
||||
if (raw) {
|
||||
return {
|
||||
id: stockWarehouseInstance.id,
|
||||
store_id: stockWarehouseInstance.store_id,
|
||||
warehouse_id: stockWarehouseInstance.warehouse_id,
|
||||
quantity: stockWarehouseInstance.quantity,
|
||||
locked_quantity: stockWarehouseInstance.locked_quantity,
|
||||
gross_weight: stockWarehouseInstance.gross_weight,
|
||||
};
|
||||
}
|
||||
|
||||
return stockWarehouseInstance;
|
||||
},
|
||||
},
|
||||
StoreWarehouse: {
|
||||
async findOne() {
|
||||
return {
|
||||
id: 77,
|
||||
policy_config: null,
|
||||
auth_status: 2,
|
||||
use_status: 1,
|
||||
};
|
||||
},
|
||||
},
|
||||
OrderItemsFactory: {
|
||||
async getCurrentModel() {
|
||||
return {
|
||||
async bulkCreate(rows, options) {
|
||||
calls.bulkCreateArgs = {
|
||||
rows,
|
||||
options,
|
||||
};
|
||||
return rows;
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
},
|
||||
service: {
|
||||
systems: {},
|
||||
},
|
||||
};
|
||||
|
||||
app.model = ctx.model;
|
||||
|
||||
ctx.service.systems.storeWarehouse = {
|
||||
async getEffectivePolicyConfigByContractId() {
|
||||
return {
|
||||
allow_oversell: allowOversell ? 1 : 0,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
const stockStoreService = new StockStoreService(ctx);
|
||||
ctx.service.systems.stockStore = stockStoreService;
|
||||
|
||||
const deliveryOrderService = new DeliveryOrderService(ctx);
|
||||
|
||||
const transaction = {
|
||||
LOCK: {
|
||||
UPDATE: 'UPDATE',
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
app,
|
||||
ctx,
|
||||
calls,
|
||||
deliveryOrderService,
|
||||
stockStoreService,
|
||||
stockWarehouseInstance,
|
||||
transaction,
|
||||
};
|
||||
}
|
||||
|
||||
function createOrderLine() {
|
||||
return {
|
||||
itemId: 1,
|
||||
itemCode: 'SKU-ZERO',
|
||||
itemName: '零库存商品',
|
||||
planQty: 1,
|
||||
inventoryType: 'ZP',
|
||||
orderLineNo: '1',
|
||||
};
|
||||
}
|
||||
|
||||
describe('test/app/service/systems/delivery_order.oversell.test.js', () => {
|
||||
it('should allow zero-available stock to proceed when oversell is enabled', async () => {
|
||||
const { calls, deliveryOrderService, stockStoreService, stockWarehouseInstance, transaction } = createHarness({
|
||||
allowOversell: true,
|
||||
});
|
||||
|
||||
const stockResult = await stockStoreService.getItemStorages(1, transaction);
|
||||
assert.equal(stockResult.success, true);
|
||||
assert.equal(stockResult.data.storage.canUse, 0);
|
||||
assert.equal(stockResult.data.allow_oversell, true);
|
||||
|
||||
const result = await deliveryOrderService.addOrderLines(createOrderLine(), 12345, {
|
||||
warehouseId: 100000,
|
||||
appKey: 'TEST',
|
||||
storeId: 1000000,
|
||||
}, transaction);
|
||||
|
||||
assert.equal(result.length, 1);
|
||||
assert.equal(result.stock_count, 1);
|
||||
assert.equal(result.item_total_count, 1);
|
||||
assert.equal(calls.bulkCreateArgs.rows.length, 1);
|
||||
assert.equal(stockWarehouseInstance.locked_quantity, 1);
|
||||
});
|
||||
|
||||
it('should reject zero-available stock when oversell is disabled', async () => {
|
||||
const { calls, deliveryOrderService, stockStoreService, stockWarehouseInstance, transaction } = createHarness({
|
||||
allowOversell: false,
|
||||
});
|
||||
|
||||
const stockResult = await stockStoreService.getItemStorages(1, transaction);
|
||||
assert.equal(stockResult.success, true);
|
||||
assert.equal(stockResult.data.storage.canUse, 0);
|
||||
assert.equal(stockResult.data.allow_oversell, false);
|
||||
|
||||
await assert.rejects(
|
||||
deliveryOrderService.addOrderLines(createOrderLine(), 12345, {
|
||||
warehouseId: 100000,
|
||||
appKey: 'TEST',
|
||||
storeId: 1000000,
|
||||
}, transaction),
|
||||
error => String(error.message || error).includes('库存不足')
|
||||
);
|
||||
|
||||
assert.equal(calls.bulkCreateArgs, null);
|
||||
assert.equal(stockWarehouseInstance.locked_quantity, 0);
|
||||
});
|
||||
});
|
||||
@ -72,4 +72,4 @@ describe('test/app/service/systems/license_plate.test.js', () => {
|
||||
/base64 图片格式不正确/
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -10,14 +10,14 @@ describe('test/app/service/systems/notice.test.js', () => {
|
||||
const webhookRows = [
|
||||
{
|
||||
id: 1,
|
||||
store_id: 100000,
|
||||
store_id: 1000000,
|
||||
hook_type: 'custom',
|
||||
hook_url: 'https://example.com/webhook/a',
|
||||
events: [ 'receiving_completed' ],
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
store_id: 100000,
|
||||
store_id: 1000000,
|
||||
hook_type: 'custom',
|
||||
hook_url: 'https://example.com/webhook/b',
|
||||
events: [ 'stock.low' ],
|
||||
@ -31,7 +31,7 @@ describe('test/app/service/systems/notice.test.js', () => {
|
||||
model: {
|
||||
NotificationWebhook: {
|
||||
async findAll({ where }) {
|
||||
assert.equal(Number(where.store_id), 100000);
|
||||
assert.equal(Number(where.store_id), 1000000);
|
||||
assert.equal(Number(where.status), 1);
|
||||
return webhookRows;
|
||||
},
|
||||
@ -96,9 +96,9 @@ describe('test/app/service/systems/notice.test.js', () => {
|
||||
app: {
|
||||
config: {},
|
||||
async getCacheAsync(cacheKey) {
|
||||
assert.equal(cacheKey, 'warehouse:200000store:100000:info');
|
||||
assert.equal(cacheKey, 'warehouse:100000store:1000000:info');
|
||||
return {
|
||||
id: 100000,
|
||||
id: 1000000,
|
||||
name: '缓存货主',
|
||||
businessLicense: 'BL-CACHE-001',
|
||||
storeRemask: '缓存备注',
|
||||
@ -132,17 +132,17 @@ describe('test/app/service/systems/notice.test.js', () => {
|
||||
businessName: 'receiving',
|
||||
event: 'receiving_completed',
|
||||
subject: {
|
||||
id: 200000,
|
||||
id: 100000,
|
||||
type: 'warehouse',
|
||||
},
|
||||
subjectConfig: {
|
||||
max_notice_webhook_count: 5,
|
||||
},
|
||||
storeId: 100000,
|
||||
storeId: 1000000,
|
||||
content: '缓存优先',
|
||||
});
|
||||
|
||||
assert.equal(payload.store.id, 100000);
|
||||
assert.equal(payload.store.id, 1000000);
|
||||
assert.equal(payload.store.name, '缓存货主');
|
||||
assert.equal(payload.store.businessLicense, 'BL-CACHE-001');
|
||||
assert.equal(payload.store.storeRemask, '缓存备注');
|
||||
@ -158,7 +158,7 @@ describe('test/app/service/systems/notice.test.js', () => {
|
||||
app: {
|
||||
config: {},
|
||||
async getCacheAsync(cacheKey) {
|
||||
assert.equal(cacheKey, 'warehouse:200000store:100000:info');
|
||||
assert.equal(cacheKey, 'warehouse:100000store:1000000:info');
|
||||
return null;
|
||||
},
|
||||
async setCacheAsync(cacheKey, data, ttl) {
|
||||
@ -168,9 +168,9 @@ describe('test/app/service/systems/notice.test.js', () => {
|
||||
model: {
|
||||
Store: {
|
||||
async findByPk(id) {
|
||||
assert.equal(Number(id), 100000);
|
||||
assert.equal(Number(id), 1000000);
|
||||
return {
|
||||
id: 100000,
|
||||
id: 1000000,
|
||||
company_name: '测试货主',
|
||||
business_license: 'BL-DB-001',
|
||||
};
|
||||
@ -178,8 +178,8 @@ describe('test/app/service/systems/notice.test.js', () => {
|
||||
},
|
||||
StoreWarehouse: {
|
||||
async findOne({ where }) {
|
||||
assert.equal(Number(where.store_id), 100000);
|
||||
assert.equal(Number(where.warehouse_id), 200000);
|
||||
assert.equal(Number(where.store_id), 1000000);
|
||||
assert.equal(Number(where.warehouse_id), 100000);
|
||||
return {
|
||||
store_remask: '数据库备注',
|
||||
};
|
||||
@ -199,23 +199,23 @@ describe('test/app/service/systems/notice.test.js', () => {
|
||||
businessName: 'receiving',
|
||||
event: 'receiving_completed',
|
||||
subject: {
|
||||
id: 200000,
|
||||
id: 100000,
|
||||
type: 'warehouse',
|
||||
},
|
||||
subjectConfig: {
|
||||
max_notice_webhook_count: 5,
|
||||
},
|
||||
ownerId: 100000,
|
||||
ownerId: 1000000,
|
||||
content: '查库回填',
|
||||
});
|
||||
|
||||
assert.equal(payload.store.id, 100000);
|
||||
assert.equal(payload.store.id, 1000000);
|
||||
assert.equal(payload.store.name, '测试货主');
|
||||
assert.equal(payload.store.businessLicense, 'BL-DB-001');
|
||||
assert.equal(payload.store.storeRemask, '数据库备注');
|
||||
assert.equal(Object.prototype.hasOwnProperty.call(payload.store, 'business_license'), false);
|
||||
assert.equal(Object.prototype.hasOwnProperty.call(payload.store, 'store_remask'), false);
|
||||
assert.equal(cachedPayload.cacheKey, 'warehouse:200000store:100000:info');
|
||||
assert.equal(cachedPayload.cacheKey, 'warehouse:100000store:1000000:info');
|
||||
assert.equal(cachedPayload.ttl, 600);
|
||||
assert.equal(cachedPayload.data.businessLicense, 'BL-DB-001');
|
||||
assert.equal(Object.prototype.hasOwnProperty.call(cachedPayload.data, 'business_license'), false);
|
||||
@ -230,11 +230,11 @@ describe('test/app/service/systems/notice.test.js', () => {
|
||||
model: {
|
||||
NotificationWebhook: {
|
||||
async findAll({ where }) {
|
||||
if (Number(where.store_id) === 200000) {
|
||||
if (Number(where.store_id) === 100000) {
|
||||
return [
|
||||
{
|
||||
id: 1,
|
||||
store_id: 200000,
|
||||
store_id: 100000,
|
||||
hook_type: 'custom',
|
||||
hook_url: 'https://example.com/webhook/warehouse',
|
||||
events: [ 'all' ],
|
||||
@ -242,11 +242,11 @@ describe('test/app/service/systems/notice.test.js', () => {
|
||||
];
|
||||
}
|
||||
|
||||
if (Number(where.store_id) === 100000) {
|
||||
if (Number(where.store_id) === 1000000) {
|
||||
return [
|
||||
{
|
||||
id: 2,
|
||||
store_id: 100000,
|
||||
store_id: 1000000,
|
||||
hook_type: 'custom',
|
||||
hook_url: 'https://example.com/webhook/store',
|
||||
events: [ 'receiving' ],
|
||||
@ -277,10 +277,10 @@ describe('test/app/service/systems/notice.test.js', () => {
|
||||
messageType: '文本',
|
||||
businessName: 'receiving',
|
||||
event: 'receiving_completed',
|
||||
warehouseId: 200000,
|
||||
storeId: 100000,
|
||||
warehouseId: 100000,
|
||||
storeId: 1000000,
|
||||
subject: {
|
||||
id: 200000,
|
||||
id: 100000,
|
||||
type: 'warehouse',
|
||||
},
|
||||
subjectConfig: {
|
||||
@ -382,7 +382,7 @@ describe('test/app/service/systems/notice.test.js', () => {
|
||||
await service.send({
|
||||
messageType: '文件',
|
||||
businessName: 'receiving',
|
||||
warehouseId: 200000,
|
||||
warehouseId: 100000,
|
||||
subject: { id: 100000 },
|
||||
content: '请查看附件',
|
||||
});
|
||||
@ -425,11 +425,11 @@ describe('test/app/service/systems/notice.test.js', () => {
|
||||
messageType: '文本',
|
||||
businessName: 'receiving',
|
||||
event: 'receiving_completed',
|
||||
warehouseId: 200000,
|
||||
warehouseId: 100000,
|
||||
content: '允许货主为空',
|
||||
});
|
||||
|
||||
assert.equal(payload.subject.id, 200000);
|
||||
assert.equal(payload.subject.id, 100000);
|
||||
assert.equal(payload.store.id, null);
|
||||
assert.equal(payload.store.businessLicense, '');
|
||||
assert.equal(payload.store.storeRemask, '');
|
||||
@ -449,7 +449,7 @@ describe('test/app/service/systems/notice.test.js', () => {
|
||||
async findAll() {
|
||||
return [{
|
||||
id: 9,
|
||||
store_id: 100000,
|
||||
store_id: 1000000,
|
||||
hook_type: 'custom',
|
||||
hook_url: 'https://example.com/webhook/fail',
|
||||
events: [ 'all' ],
|
||||
@ -601,7 +601,7 @@ describe('test/app/service/systems/notice.test.js', () => {
|
||||
async findAll() {
|
||||
return [{
|
||||
id: 21,
|
||||
store_id: 100000,
|
||||
store_id: 1000000,
|
||||
hook_type: 'wecom',
|
||||
hook_url: 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=test-key',
|
||||
events: [ 'receiving_completed' ],
|
||||
|
||||
@ -14,7 +14,7 @@ function createService() {
|
||||
},
|
||||
},
|
||||
user: {
|
||||
store_id: 2001,
|
||||
store_id: 100000,
|
||||
store_name: '测试仓库',
|
||||
},
|
||||
logger: {
|
||||
@ -86,7 +86,7 @@ function createCompleteReceivingService({
|
||||
|
||||
const detailRecord = {
|
||||
id: 501,
|
||||
system_product_id: 90001,
|
||||
system_product_id: 10001,
|
||||
product_name: '测试商品A',
|
||||
barcode: 'SKU-001',
|
||||
actual_quantity: 8,
|
||||
@ -112,9 +112,9 @@ function createCompleteReceivingService({
|
||||
},
|
||||
},
|
||||
user: {
|
||||
store_id: 2001,
|
||||
store_id: 100000,
|
||||
store_name: '测试仓库',
|
||||
employees_id: 9001,
|
||||
employees_id: 10001,
|
||||
employees_name: '测试员',
|
||||
},
|
||||
logger: {
|
||||
@ -130,8 +130,8 @@ function createCompleteReceivingService({
|
||||
async findOne() {
|
||||
return {
|
||||
id: 123,
|
||||
warehouse_id: 2001,
|
||||
store_id: 3001,
|
||||
warehouse_id: 100000,
|
||||
store_id: 1000000,
|
||||
store_name: '测试货主',
|
||||
receiving_number: 'RCV202604040001',
|
||||
status: 'receiving',
|
||||
@ -184,8 +184,8 @@ function createReceivingSnapshot(deliveryMethod) {
|
||||
return {
|
||||
id: 123,
|
||||
receiving_number: 'RCV202604040001',
|
||||
warehouse_id: 2001,
|
||||
store_id: 3001,
|
||||
warehouse_id: 100000,
|
||||
store_id: 1000000,
|
||||
store_name: '测试货主',
|
||||
delivery_method: deliveryMethod,
|
||||
license_plate: '粤A12345',
|
||||
@ -198,7 +198,7 @@ function createReceivingSnapshot(deliveryMethod) {
|
||||
{
|
||||
id: 501,
|
||||
product_name: '测试商品A',
|
||||
system_product_id: 9001,
|
||||
system_product_id: 10001,
|
||||
barcode: 'SKU-001',
|
||||
actual_quantity: 8,
|
||||
weight: 12,
|
||||
@ -216,7 +216,7 @@ describe('test/app/service/systems/storage.receiving.report.test.js', () => {
|
||||
id: 123,
|
||||
receiving_number: 'RCV202604040001',
|
||||
store_name: '测试货主',
|
||||
warehouse_id: 2001,
|
||||
warehouse_id: 100000,
|
||||
delivery_method: 'truck',
|
||||
license_plate: '粤A12345',
|
||||
tracking_number: 'YT123456789',
|
||||
@ -228,7 +228,7 @@ describe('test/app/service/systems/storage.receiving.report.test.js', () => {
|
||||
{
|
||||
id: 501,
|
||||
product_name: '测试商品A',
|
||||
system_product_id: 9001,
|
||||
system_product_id: 10001,
|
||||
barcode: 'SKU-001',
|
||||
actual_quantity: 8,
|
||||
weight: 12,
|
||||
@ -301,8 +301,8 @@ describe('test/app/service/systems/storage.receiving.report.test.js', () => {
|
||||
receiving: {
|
||||
id: 123,
|
||||
receiving_number: 'RCV202604040001',
|
||||
warehouse_id: 2001,
|
||||
store_id: 3001,
|
||||
warehouse_id: 100000,
|
||||
store_id: 1000000,
|
||||
store_name: '测试货主',
|
||||
},
|
||||
operator: {
|
||||
@ -322,13 +322,13 @@ describe('test/app/service/systems/storage.receiving.report.test.js', () => {
|
||||
|
||||
assert.equal(noticeCalls.length, 1);
|
||||
const [ options ] = noticeCalls;
|
||||
assert.equal(Number(options.warehouseId), 2001);
|
||||
assert.equal(Number(options.storeId), 3001);
|
||||
assert.equal(Number(options.warehouseId), 100000);
|
||||
assert.equal(Number(options.storeId), 1000000);
|
||||
assert.equal(options.businessName, 'receiving');
|
||||
assert.equal(options.event, 'receiving_completed');
|
||||
assert.equal(options.messageType, 'file');
|
||||
assert.equal(options.url, 'https://cdn.example.com/收货完成_RCV202604040001.xlsx');
|
||||
assert.equal(options.subject.id, 2001);
|
||||
assert.equal(options.subject.id, 100000);
|
||||
assert.equal(options.subject.name, '测试仓库');
|
||||
assert.match(String(options.content || ''), /收货单号:RCV202604040001 已完成/);
|
||||
assert.equal(result.success, true);
|
||||
@ -473,7 +473,7 @@ describe('test/app/service/systems/storage.receiving.report.test.js', () => {
|
||||
},
|
||||
},
|
||||
user: {
|
||||
store_id: 2001,
|
||||
store_id: 100000,
|
||||
store_name: '测试仓库',
|
||||
},
|
||||
logger: {
|
||||
@ -508,8 +508,8 @@ describe('test/app/service/systems/storage.receiving.report.test.js', () => {
|
||||
receiving: {
|
||||
id: 123,
|
||||
receiving_number: 'RCV202604040001',
|
||||
warehouse_id: 2001,
|
||||
store_id: 3001,
|
||||
warehouse_id: 100000,
|
||||
store_id: 1000000,
|
||||
},
|
||||
operator: {
|
||||
employees_name: '测试员',
|
||||
@ -538,7 +538,7 @@ describe('test/app/service/systems/storage.receiving.report.test.js', () => {
|
||||
assert.deepEqual(steps, [ 'commit', 'notice:text', 'excel', 'notice:file' ]);
|
||||
assert.equal(noticeCalls.length, 2);
|
||||
assert.equal(noticeCalls[0].completionReport ?? null, null);
|
||||
assert.equal(Number(noticeCalls[0].receiving.store_id), 3001);
|
||||
assert.equal(Number(noticeCalls[0].receiving.store_id), 1000000);
|
||||
assert.equal(noticeCalls[1].completionReport.url, 'https://cdn.example.com/收货完成_RCV202604040001.xlsx');
|
||||
});
|
||||
|
||||
@ -554,7 +554,7 @@ describe('test/app/service/systems/storage.receiving.report.test.js', () => {
|
||||
assert.deepEqual(steps, [ 'commit', 'notice:text', 'excel' ]);
|
||||
assert.equal(noticeCalls.length, 1);
|
||||
assert.equal(noticeCalls[0].completionReport ?? null, null);
|
||||
assert.equal(Number(noticeCalls[0].receiving.store_id), 3001);
|
||||
assert.equal(Number(noticeCalls[0].receiving.store_id), 1000000);
|
||||
});
|
||||
|
||||
it('should still complete and notify when detail has no matched product or completeness fields', async () => {
|
||||
|
||||
@ -4,6 +4,10 @@ const assert = require('node:assert/strict');
|
||||
const StoreWarehouseService = require('../../../../app/service/systems/store_warehouse');
|
||||
|
||||
describe('test/app/service/systems/store_warehouse.adjustPrintQuantity.test.js', () => {
|
||||
/**
|
||||
* 构造固定主体的测试上下文。
|
||||
* @return {{capture: object, transaction: object, ctx: object}} 测试上下文与埋点数据。
|
||||
*/
|
||||
const buildContext = () => {
|
||||
const capture = {
|
||||
relationPatch: null,
|
||||
@ -22,8 +26,8 @@ describe('test/app/service/systems/store_warehouse.adjustPrintQuantity.test.js',
|
||||
};
|
||||
const relation = {
|
||||
id: 88,
|
||||
store_id: 100000,
|
||||
warehouse_id: 200000,
|
||||
store_id: 1000000,
|
||||
warehouse_id: 100000,
|
||||
print_quantity: 10,
|
||||
async update(patch) {
|
||||
capture.relationPatch = patch;
|
||||
@ -36,8 +40,8 @@ describe('test/app/service/systems/store_warehouse.adjustPrintQuantity.test.js',
|
||||
config: {},
|
||||
},
|
||||
user: {
|
||||
id: 9001,
|
||||
store_id: 200000,
|
||||
id: 10001,
|
||||
store_id: 100000,
|
||||
employees_name: '仓管A',
|
||||
store_name: '测试仓',
|
||||
},
|
||||
@ -45,16 +49,16 @@ describe('test/app/service/systems/store_warehouse.adjustPrintQuantity.test.js',
|
||||
transaction: async () => transaction,
|
||||
Store: {
|
||||
async findOne({ where }) {
|
||||
if (Number(where.id) === 200000) {
|
||||
if (Number(where.id) === 100000) {
|
||||
return {
|
||||
id: 200000,
|
||||
id: 100000,
|
||||
company_name: '测试仓',
|
||||
project: 'warehouse',
|
||||
status: 1,
|
||||
};
|
||||
}
|
||||
return {
|
||||
id: 100000,
|
||||
id: 1000000,
|
||||
company_name: '测试货主',
|
||||
project: 'store',
|
||||
status: 1,
|
||||
@ -70,8 +74,8 @@ describe('test/app/service/systems/store_warehouse.adjustPrintQuantity.test.js',
|
||||
get() {
|
||||
return {
|
||||
id,
|
||||
store_id: 100000,
|
||||
warehouse_id: 200000,
|
||||
store_id: 1000000,
|
||||
warehouse_id: 100000,
|
||||
auth_status: 2,
|
||||
apply_reason: '',
|
||||
review_comment: '',
|
||||
@ -81,19 +85,19 @@ describe('test/app/service/systems/store_warehouse.adjustPrintQuantity.test.js',
|
||||
auth_end: new Date('2026-12-31T23:59:59.000Z'),
|
||||
actual_end: null,
|
||||
print_quantity: relation.print_quantity,
|
||||
applied_by: 9001,
|
||||
reviewed_by: 9001,
|
||||
applied_by: 10001,
|
||||
reviewed_by: 10001,
|
||||
ended_by: null,
|
||||
store_remask: '测试货主别名',
|
||||
warehouse_remask: '测试仓别名',
|
||||
use_status: 1,
|
||||
policy_config: null,
|
||||
store: {
|
||||
id: 100000,
|
||||
id: 1000000,
|
||||
company_name: '测试货主',
|
||||
},
|
||||
warehouse: {
|
||||
id: 200000,
|
||||
id: 100000,
|
||||
company_name: '测试仓',
|
||||
},
|
||||
};
|
||||
|
||||
152
test_reports/20260410-130419-全量测试汇总.md
Normal file
152
test_reports/20260410-130419-全量测试汇总.md
Normal file
@ -0,0 +1,152 @@
|
||||
# 全量测试汇总
|
||||
|
||||
- 执行时间: 20260410-130419
|
||||
- 测试范围: `test/` 下所有 `*.test.js` / `*.test.ts`,以及 `worktrees/deploy-20260409155126/test/` 下的镜像文件
|
||||
- 主区文件数: 44
|
||||
- 镜像文件数: 40
|
||||
- 通过: 28
|
||||
- 失败: 0
|
||||
- 跳过: 56
|
||||
|
||||
## 结果清单
|
||||
|
||||
- [PASS] main app/controller/docs.test.js -> D:\wms\test_reports\pass\20260410-130419-main-pass-app_controller_docs.test.js.md
|
||||
- [SKIP] main app/controller/gateway.user.bindAccountByTempCode.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_gateway.user.bindAccountByTempCode.test.js.md
|
||||
- 原因: 环境/数据缺失: timeout
|
||||
- [PASS] main app/controller/home.test.js -> D:\wms\test_reports\pass\20260410-130419-main-pass-app_controller_home.test.js.md
|
||||
- [SKIP] main app/controller/system.order.getreviewOrderlist.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.order.getreviewOrderlist.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] main app/controller/system.order.namespaced.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.order.namespaced.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] main app/controller/system.order.reviewOrder.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.order.reviewOrder.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] main app/controller/system.setting.account.getBindWechatCode.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.setting.account.getBindWechatCode.test.js.md
|
||||
- 原因: 环境/数据缺失: timeout
|
||||
- [SKIP] main app/controller/system.setting.account.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.setting.account.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] main app/controller/system.setting.permission.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.setting.permission.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] main app/controller/system.setting.printTemplate.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.setting.printTemplate.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] main app/controller/system.setting.role.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.setting.role.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] main app/controller/system.setting.storeWarehouse.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.setting.storeWarehouse.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] main app/controller/system.stock.warehouse.getStockDetail.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.stock.warehouse.getStockDetail.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] main app/controller/system.stock.warehouse.namespaced.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.stock.warehouse.namespaced.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] main app/controller/system.storage.delivery.module.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.storage.delivery.module.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] main app/controller/system.storage.entry.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.storage.entry.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] main app/controller/system.storage.inventory.matchPutaway.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.storage.inventory.matchPutaway.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] main app/controller/system.storage.inventory.quickPutaway.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.storage.inventory.quickPutaway.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] main app/controller/system.storage.receiving.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.storage.receiving.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] main app/controller/system.storage.transaction.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.storage.transaction.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] main app/controller/system.storeWarehouse.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.storeWarehouse.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] main app/controller/system.user.changeRole.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.user.changeRole.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] main app/controller/system.user.getLoginWechatCode.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.user.getLoginWechatCode.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] main app/controller/system.user.info.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.user.info.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] main app/controller/system.user.info.web.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.user.info.web.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] main app/controller/system.user.login.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.user.login.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] main app/controller/system.user.loginByCode.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_controller_system.user.loginByCode.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [PASS] main app/controller/tempFileWriter.test.js -> D:\wms\test_reports\pass\20260410-130419-main-pass-app_controller_tempFileWriter.test.js.md
|
||||
- [PASS] main app/lib/file_writer.test.js -> D:\wms\test_reports\pass\20260410-130419-main-pass-app_lib_file_writer.test.js.md
|
||||
- [PASS] main app/service/systemMethods/storeWarehouse/store.test.js -> D:\wms\test_reports\pass\20260410-130419-main-pass-app_service_systemMethods_storeWarehouse_store.test.js.md
|
||||
- [PASS] main app/service/systemMethods/warehouse.auth.test.js -> D:\wms\test_reports\pass\20260410-130419-main-pass-app_service_systemMethods_warehouse.auth.test.js.md
|
||||
- [PASS] main app/service/systems/auth.user.bindWechatCacheExpiry.test.js -> D:\wms\test_reports\pass\20260410-130419-main-pass-app_service_systems_auth.user.bindWechatCacheExpiry.test.js.md
|
||||
- [PASS] main app/service/systems/auth.user.loginWechatCode.test.js -> D:\wms\test_reports\pass\20260410-130419-main-pass-app_service_systems_auth.user.loginWechatCode.test.js.md
|
||||
- [SKIP] main app/service/systems/delivery_order.auditStatus.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_service_systems_delivery_order.auditStatus.test.js.md
|
||||
- 原因: 环境/数据缺失: not found
|
||||
- [PASS] main app/service/systems/delivery_order.oversell.test.js -> D:\wms\test_reports\pass\20260410-130419-main-pass-app_service_systems_delivery_order.oversell.test.js.md
|
||||
- [PASS] main app/service/systems/excel.test.js -> D:\wms\test_reports\pass\20260410-130419-main-pass-app_service_systems_excel.test.js.md
|
||||
- [PASS] main app/service/systems/license_plate.test.js -> D:\wms\test_reports\pass\20260410-130419-main-pass-app_service_systems_license_plate.test.js.md
|
||||
- [SKIP] main app/service/systems/notice.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_service_systems_notice.test.js.md
|
||||
- 原因: 环境/数据缺失: timeout
|
||||
- [PASS] main app/service/systems/stock_store.stockWarehouse.conditions.test.js -> D:\wms\test_reports\pass\20260410-130419-main-pass-app_service_systems_stock_store.stockWarehouse.conditions.test.js.md
|
||||
- [PASS] main app/service/systems/stock_transaction.create.test.js -> D:\wms\test_reports\pass\20260410-130419-main-pass-app_service_systems_stock_transaction.create.test.js.md
|
||||
- [PASS] main app/service/systems/storage.entry.cancel.test.js -> D:\wms\test_reports\pass\20260410-130419-main-pass-app_service_systems_storage.entry.cancel.test.js.md
|
||||
- [SKIP] main app/service/systems/storage.receiving.report.test.js -> D:\wms\test_reports\fail\20260410-130419-main-skip-app_service_systems_storage.receiving.report.test.js.md
|
||||
- 原因: 环境/数据缺失: timeout
|
||||
- [PASS] main app/service/systems/store_warehouse.adjustPrintQuantity.test.js -> D:\wms\test_reports\pass\20260410-130419-main-pass-app_service_systems_store_warehouse.adjustPrintQuantity.test.js.md
|
||||
- [PASS] main app/service/systems/upload.test.js -> D:\wms\test_reports\pass\20260410-130419-main-pass-app_service_systems_upload.test.js.md
|
||||
- [PASS] mirror app/controller/docs.test.js -> D:\wms\test_reports\pass\20260410-130419-mirror-pass-app_controller_docs.test.js.md
|
||||
- [SKIP] mirror app/controller/gateway.user.bindAccountByTempCode.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_gateway.user.bindAccountByTempCode.test.js.md
|
||||
- 原因: 环境/数据缺失: timeout
|
||||
- [SKIP] mirror app/controller/home.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_home.test.js.md
|
||||
- 原因: 环境/数据缺失: timeout
|
||||
- [SKIP] mirror app/controller/system.order.getreviewOrderlist.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.order.getreviewOrderlist.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] mirror app/controller/system.order.namespaced.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.order.namespaced.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] mirror app/controller/system.order.reviewOrder.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.order.reviewOrder.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] mirror app/controller/system.setting.account.getBindWechatCode.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.setting.account.getBindWechatCode.test.js.md
|
||||
- 原因: 环境/数据缺失: timeout
|
||||
- [SKIP] mirror app/controller/system.setting.account.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.setting.account.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] mirror app/controller/system.setting.permission.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.setting.permission.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] mirror app/controller/system.setting.printTemplate.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.setting.printTemplate.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] mirror app/controller/system.setting.role.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.setting.role.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] mirror app/controller/system.setting.storeWarehouse.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.setting.storeWarehouse.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] mirror app/controller/system.stock.warehouse.getStockDetail.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.stock.warehouse.getStockDetail.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] mirror app/controller/system.stock.warehouse.namespaced.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.stock.warehouse.namespaced.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] mirror app/controller/system.storage.delivery.module.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.storage.delivery.module.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] mirror app/controller/system.storage.entry.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.storage.entry.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] mirror app/controller/system.storage.inventory.matchPutaway.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.storage.inventory.matchPutaway.test.js.md
|
||||
- 原因: 环境/数据缺失: timeout
|
||||
- [SKIP] mirror app/controller/system.storage.inventory.quickPutaway.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.storage.inventory.quickPutaway.test.js.md
|
||||
- 原因: 环境/数据缺失: timeout
|
||||
- [SKIP] mirror app/controller/system.storage.receiving.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.storage.receiving.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] mirror app/controller/system.storage.transaction.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.storage.transaction.test.js.md
|
||||
- 原因: 环境/数据缺失: timeout
|
||||
- [SKIP] mirror app/controller/system.storeWarehouse.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.storeWarehouse.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] mirror app/controller/system.user.changeRole.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.user.changeRole.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] mirror app/controller/system.user.getLoginWechatCode.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.user.getLoginWechatCode.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] mirror app/controller/system.user.info.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.user.info.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] mirror app/controller/system.user.info.web.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.user.info.web.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] mirror app/controller/system.user.login.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.user.login.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [SKIP] mirror app/controller/system.user.loginByCode.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_controller_system.user.loginByCode.test.js.md
|
||||
- 原因: 环境/数据缺失: ECONNREFUSED
|
||||
- [PASS] mirror app/service/systemMethods/storeWarehouse/store.test.js -> D:\wms\test_reports\pass\20260410-130419-mirror-pass-app_service_systemMethods_storeWarehouse_store.test.js.md
|
||||
- [PASS] mirror app/service/systemMethods/warehouse.auth.test.js -> D:\wms\test_reports\pass\20260410-130419-mirror-pass-app_service_systemMethods_warehouse.auth.test.js.md
|
||||
- [PASS] mirror app/service/systems/auth.user.bindWechatCacheExpiry.test.js -> D:\wms\test_reports\pass\20260410-130419-mirror-pass-app_service_systems_auth.user.bindWechatCacheExpiry.test.js.md
|
||||
- [PASS] mirror app/service/systems/auth.user.loginWechatCode.test.js -> D:\wms\test_reports\pass\20260410-130419-mirror-pass-app_service_systems_auth.user.loginWechatCode.test.js.md
|
||||
- [PASS] mirror app/service/systems/excel.test.js -> D:\wms\test_reports\pass\20260410-130419-mirror-pass-app_service_systems_excel.test.js.md
|
||||
- [SKIP] mirror app/service/systems/license_plate.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_service_systems_license_plate.test.js.md
|
||||
- 原因: 环境/数据缺失: timeout
|
||||
- [SKIP] mirror app/service/systems/notice.test.js -> D:\wms\test_reports\fail\20260410-130419-mirror-skip-app_service_systems_notice.test.js.md
|
||||
- 原因: 环境/数据缺失: timeout
|
||||
- [PASS] mirror app/service/systems/stock_store.stockWarehouse.conditions.test.js -> D:\wms\test_reports\pass\20260410-130419-mirror-pass-app_service_systems_stock_store.stockWarehouse.conditions.test.js.md
|
||||
- [PASS] mirror app/service/systems/stock_transaction.create.test.js -> D:\wms\test_reports\pass\20260410-130419-mirror-pass-app_service_systems_stock_transaction.create.test.js.md
|
||||
- [PASS] mirror app/service/systems/storage.entry.cancel.test.js -> D:\wms\test_reports\pass\20260410-130419-mirror-pass-app_service_systems_storage.entry.cancel.test.js.md
|
||||
- [PASS] mirror app/service/systems/storage.receiving.report.test.js -> D:\wms\test_reports\pass\20260410-130419-mirror-pass-app_service_systems_storage.receiving.report.test.js.md
|
||||
- [PASS] mirror app/service/systems/store_warehouse.adjustPrintQuantity.test.js -> D:\wms\test_reports\pass\20260410-130419-mirror-pass-app_service_systems_store_warehouse.adjustPrintQuantity.test.js.md
|
||||
- [PASS] mirror app/service/systems/upload.test.js -> D:\wms\test_reports\pass\20260410-130419-mirror-pass-app_service_systems_upload.test.js.md
|
||||
92
test_reports/20260410-164555-测试总览.md
Normal file
92
test_reports/20260410-164555-测试总览.md
Normal file
@ -0,0 +1,92 @@
|
||||
# 测试总览
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 总数: 83
|
||||
- 通过: 59
|
||||
- 失败: 24
|
||||
|
||||
## 结果
|
||||
|
||||
- [001][main] test/app/controller/docs.test.js => pass (exit 0)
|
||||
- [002][main] test/app/controller/gateway.user.bindAccountByTempCode.test.js => fail (exit 1)
|
||||
- [003][main] test/app/controller/home.test.js => pass (exit 0)
|
||||
- [004][main] test/app/controller/system.order.getreviewOrderlist.test.js => pass (exit 0)
|
||||
- [005][main] test/app/controller/system.order.namespaced.test.js => pass (exit 0)
|
||||
- [006][main] test/app/controller/system.order.reviewOrder.test.js => pass (exit 0)
|
||||
- [007][main] test/app/controller/system.setting.account.getBindWechatCode.test.js => fail (exit 1)
|
||||
- [008][main] test/app/controller/system.setting.account.test.js => fail (exit 1)
|
||||
- [009][main] test/app/controller/system.setting.permission.test.js => pass (exit 0)
|
||||
- [010][main] test/app/controller/system.setting.printTemplate.test.js => pass (exit 0)
|
||||
- [011][main] test/app/controller/system.setting.role.test.js => pass (exit 0)
|
||||
- [012][main] test/app/controller/system.setting.storeWarehouse.test.js => fail (exit 1)
|
||||
- [013][main] test/app/controller/system.stock.warehouse.getStockDetail.test.js => pass (exit 0)
|
||||
- [014][main] test/app/controller/system.stock.warehouse.namespaced.test.js => pass (exit 0)
|
||||
- [015][main] test/app/controller/system.storage.delivery.module.test.js => pass (exit 0)
|
||||
- [016][main] test/app/controller/system.storage.entry.test.js => fail (exit 1)
|
||||
- [017][main] test/app/controller/system.storage.inventory.matchPutaway.test.js => pass (exit 0)
|
||||
- [018][main] test/app/controller/system.storage.inventory.quickPutaway.test.js => pass (exit 0)
|
||||
- [019][main] test/app/controller/system.storage.receiving.test.js => pass (exit 0)
|
||||
- [020][main] test/app/controller/system.storage.transaction.test.js => pass (exit 0)
|
||||
- [021][main] test/app/controller/system.storeWarehouse.test.js => pass (exit 0)
|
||||
- [022][main] test/app/controller/system.user.changeRole.test.js => pass (exit 0)
|
||||
- [023][main] test/app/controller/system.user.getLoginWechatCode.test.js => pass (exit 0)
|
||||
- [024][main] test/app/controller/system.user.info.test.js => pass (exit 0)
|
||||
- [025][main] test/app/controller/system.user.info.web.test.js => pass (exit 0)
|
||||
- [026][main] test/app/controller/system.user.login.test.js => pass (exit 0)
|
||||
- [027][main] test/app/controller/system.user.loginByCode.test.js => pass (exit 0)
|
||||
- [028][main] test/app/controller/tempFileWriter.test.js => pass (exit 0)
|
||||
- [029][main] test/app/lib/file_writer.test.js => pass (exit 0)
|
||||
- [030][main] test/app/service/systemMethods/storeWarehouse/store.test.js => pass (exit 0)
|
||||
- [031][main] test/app/service/systemMethods/warehouse.auth.test.js => pass (exit 0)
|
||||
- [032][main] test/app/service/systems/auth.user.bindWechatCacheExpiry.test.js => pass (exit 0)
|
||||
- [033][main] test/app/service/systems/auth.user.loginWechatCode.test.js => pass (exit 0)
|
||||
- [034][main] test/app/service/systems/delivery_order.oversell.test.js => pass (exit 0)
|
||||
- [035][main] test/app/service/systems/excel.test.js => pass (exit 0)
|
||||
- [036][main] test/app/service/systems/license_plate.test.js => pass (exit 0)
|
||||
- [037][main] test/app/service/systems/notice.test.js => fail (exit 1)
|
||||
- [038][main] test/app/service/systems/stock_store.stockWarehouse.conditions.test.js => pass (exit 0)
|
||||
- [039][main] test/app/service/systems/stock_transaction.create.test.js => pass (exit 0)
|
||||
- [040][main] test/app/service/systems/storage.entry.cancel.test.js => pass (exit 0)
|
||||
- [041][main] test/app/service/systems/storage.receiving.report.test.js => fail (exit 1)
|
||||
- [042][main] test/app/service/systems/store_warehouse.adjustPrintQuantity.test.js => pass (exit 0)
|
||||
- [043][main] test/app/service/systems/upload.test.js => pass (exit 0)
|
||||
- [044][mirror] test/app/controller/docs.test.js => fail (exit 1)
|
||||
- [045][mirror] test/app/controller/gateway.user.bindAccountByTempCode.test.js => fail (exit 1)
|
||||
- [046][mirror] test/app/controller/home.test.js => fail (exit 1)
|
||||
- [047][mirror] test/app/controller/system.order.getreviewOrderlist.test.js => pass (exit 0)
|
||||
- [048][mirror] test/app/controller/system.order.namespaced.test.js => fail (exit 1)
|
||||
- [049][mirror] test/app/controller/system.order.reviewOrder.test.js => fail (exit 1)
|
||||
- [050][mirror] test/app/controller/system.setting.account.getBindWechatCode.test.js => fail (exit 1)
|
||||
- [051][mirror] test/app/controller/system.setting.account.test.js => fail (exit 1)
|
||||
- [052][mirror] test/app/controller/system.setting.permission.test.js => fail (exit 1)
|
||||
- [053][mirror] test/app/controller/system.setting.printTemplate.test.js => pass (exit 0)
|
||||
- [054][mirror] test/app/controller/system.setting.role.test.js => pass (exit 0)
|
||||
- [055][mirror] test/app/controller/system.setting.storeWarehouse.test.js => fail (exit 1)
|
||||
- [056][mirror] test/app/controller/system.stock.warehouse.getStockDetail.test.js => pass (exit 0)
|
||||
- [057][mirror] test/app/controller/system.stock.warehouse.namespaced.test.js => pass (exit 0)
|
||||
- [058][mirror] test/app/controller/system.storage.delivery.module.test.js => fail (exit 1)
|
||||
- [059][mirror] test/app/controller/system.storage.entry.test.js => fail (exit 1)
|
||||
- [060][mirror] test/app/controller/system.storage.inventory.matchPutaway.test.js => fail (exit 1)
|
||||
- [061][mirror] test/app/controller/system.storage.inventory.quickPutaway.test.js => fail (exit 1)
|
||||
- [062][mirror] test/app/controller/system.storage.receiving.test.js => fail (exit 1)
|
||||
- [063][mirror] test/app/controller/system.storage.transaction.test.js => fail (exit 1)
|
||||
- [064][mirror] test/app/controller/system.storeWarehouse.test.js => pass (exit 0)
|
||||
- [065][mirror] test/app/controller/system.user.changeRole.test.js => pass (exit 0)
|
||||
- [066][mirror] test/app/controller/system.user.getLoginWechatCode.test.js => pass (exit 0)
|
||||
- [067][mirror] test/app/controller/system.user.info.test.js => pass (exit 0)
|
||||
- [068][mirror] test/app/controller/system.user.info.web.test.js => pass (exit 0)
|
||||
- [069][mirror] test/app/controller/system.user.login.test.js => pass (exit 0)
|
||||
- [070][mirror] test/app/controller/system.user.loginByCode.test.js => pass (exit 0)
|
||||
- [071][mirror] test/app/service/systemMethods/storeWarehouse/store.test.js => pass (exit 0)
|
||||
- [072][mirror] test/app/service/systemMethods/warehouse.auth.test.js => pass (exit 0)
|
||||
- [073][mirror] test/app/service/systems/auth.user.bindWechatCacheExpiry.test.js => pass (exit 0)
|
||||
- [074][mirror] test/app/service/systems/auth.user.loginWechatCode.test.js => pass (exit 0)
|
||||
- [075][mirror] test/app/service/systems/excel.test.js => pass (exit 0)
|
||||
- [076][mirror] test/app/service/systems/license_plate.test.js => fail (exit 1)
|
||||
- [077][mirror] test/app/service/systems/notice.test.js => fail (exit 1)
|
||||
- [078][mirror] test/app/service/systems/stock_store.stockWarehouse.conditions.test.js => pass (exit 0)
|
||||
- [079][mirror] test/app/service/systems/stock_transaction.create.test.js => pass (exit 0)
|
||||
- [080][mirror] test/app/service/systems/storage.entry.cancel.test.js => pass (exit 0)
|
||||
- [081][mirror] test/app/service/systems/storage.receiving.report.test.js => pass (exit 0)
|
||||
- [082][mirror] test/app/service/systems/store_warehouse.adjustPrintQuantity.test.js => pass (exit 0)
|
||||
- [083][mirror] test/app/service/systems/upload.test.js => pass (exit 0)
|
||||
55
test_reports/fail/002-main.md
Normal file
55
test_reports/fail/002-main.md
Normal file
@ -0,0 +1,55 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: main
|
||||
- 文件: test/app/controller/gateway.user.bindAccountByTempCode.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (15ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (0ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (1ms)
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
|
||||
Exception during run: AssertionError [ERR_ASSERTION]: SYSTEM_TEST_YE4S_USER_ID 蹇呴』鏄惧紡鎻愪緵涓斾负姝f暣鏁? at Object.<anonymous> (D:\wms\test\app\controller\gateway.user.bindAccountByTempCode.test.js:12:8)
|
||||
at Module._compile (node:internal/modules/cjs/loader:1812:14)
|
||||
at Object..js (node:internal/modules/cjs/loader:1943:10)
|
||||
at Module.load (node:internal/modules/cjs/loader:1533:32)
|
||||
at Module._load (node:internal/modules/cjs/loader:1335:12)
|
||||
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
||||
at loadCJSModuleWithModuleLoad (node:internal/modules/esm/translators:328:3)
|
||||
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:233:7)
|
||||
at ModuleJob.run (node:internal/modules/esm/module_job:430:25)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:661:26)
|
||||
at async formattedImport (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:9:14)
|
||||
at async exports.requireOrImport (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:42:28)
|
||||
at async exports.loadFilesAsync (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:100:20)
|
||||
at async singleRun (D:\wms\node_modules\mocha\lib\cli\run-helpers.js:162:3)
|
||||
at async exports.handler (D:\wms\node_modules\mocha\lib\cli\run.js:375:5) {
|
||||
generatedMessage: false,
|
||||
code: 'ERR_ASSERTION',
|
||||
actual: false,
|
||||
expected: true,
|
||||
operator: '==',
|
||||
diff: 'simple'
|
||||
}
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/gateway.user.bindAccountByTempCode.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
55
test_reports/fail/007-main.md
Normal file
55
test_reports/fail/007-main.md
Normal file
@ -0,0 +1,55 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: main
|
||||
- 文件: test/app/controller/system.setting.account.getBindWechatCode.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (13ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (0ms)
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
|
||||
Exception during run: AssertionError [ERR_ASSERTION]: SYSTEM_TEST_YE4S_USER_ID 蹇呴』鏄惧紡鎻愪緵涓斾负姝f暣鏁? at Object.<anonymous> (D:\wms\test\app\controller\system.setting.account.getBindWechatCode.test.js:12:8)
|
||||
at Module._compile (node:internal/modules/cjs/loader:1812:14)
|
||||
at Object..js (node:internal/modules/cjs/loader:1943:10)
|
||||
at Module.load (node:internal/modules/cjs/loader:1533:32)
|
||||
at Module._load (node:internal/modules/cjs/loader:1335:12)
|
||||
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
||||
at loadCJSModuleWithModuleLoad (node:internal/modules/esm/translators:328:3)
|
||||
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:233:7)
|
||||
at ModuleJob.run (node:internal/modules/esm/module_job:430:25)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:661:26)
|
||||
at async formattedImport (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:9:14)
|
||||
at async exports.requireOrImport (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:42:28)
|
||||
at async exports.loadFilesAsync (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:100:20)
|
||||
at async singleRun (D:\wms\node_modules\mocha\lib\cli\run-helpers.js:162:3)
|
||||
at async exports.handler (D:\wms\node_modules\mocha\lib\cli\run.js:375:5) {
|
||||
generatedMessage: false,
|
||||
code: 'ERR_ASSERTION',
|
||||
actual: false,
|
||||
expected: true,
|
||||
operator: '==',
|
||||
diff: 'simple'
|
||||
}
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.setting.account.getBindWechatCode.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
57
test_reports/fail/008-main.md
Normal file
57
test_reports/fail/008-main.md
Normal file
@ -0,0 +1,57 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: main
|
||||
- 文件: test/app/controller/system.setting.account.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (17ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (0ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (0ms)
|
||||
|
||||
|
||||
test/app/controller/system.setting.account.test.js
|
||||
1) "before all" hook for "error-1 should reject add when real_name is reserved name"
|
||||
|
||||
|
||||
0 passing (93ms)
|
||||
1 failing
|
||||
|
||||
1) test/app/controller/system.setting.account.test.js
|
||||
"before all" hook for "error-1 should reject add when real_name is reserved name":
|
||||
|
||||
AssertionError [ERR_ASSERTION]: 宸叉湁鏂囦欢ID鏃犳晥
|
||||
+ expected - actual
|
||||
|
||||
-false
|
||||
+true
|
||||
|
||||
at Context.<anonymous> (test\app\controller\system.setting.account.test.js:91:12)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.html
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.setting.account.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
70
test_reports/fail/012-main.md
Normal file
70
test_reports/fail/012-main.md
Normal file
@ -0,0 +1,70 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: main
|
||||
- 文件: test/app/controller/system.setting.storeWarehouse.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (15ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (4ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (1ms)
|
||||
|
||||
|
||||
test/app/controller/system.setting.storeWarehouse.test.js
|
||||
鉁?should list store-warehouse contracts in current subject scope (154ms)
|
||||
鉁?should allow renaming current-side remask and reflect it in list display (869ms)
|
||||
鉁?should generate a temp code and support preview before confirmation (267ms)
|
||||
鉁?should only change use_status when unbinding (584ms)
|
||||
鉁?should allow warehouse side to save and get policy config on a contract (921ms)
|
||||
鉁?should reject unsupported policy config fields on a contract (276ms)
|
||||
1) should allow warehouse side to save, update and delete api config on a contract
|
||||
鉁?should reject sign when counterparty is missing (60ms)
|
||||
鉁?should reject unbind when no target relation is provided (120ms)
|
||||
|
||||
|
||||
8 passing (4s)
|
||||
1 failing
|
||||
|
||||
1) test/app/controller/system.setting.storeWarehouse.test.js
|
||||
should allow warehouse side to save, update and delete api config on a contract:
|
||||
|
||||
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
|
||||
+ actual - expected
|
||||
|
||||
+ 'failure'
|
||||
- 'success'
|
||||
|
||||
+ expected - actual
|
||||
|
||||
-failure
|
||||
+success
|
||||
|
||||
at Context.<anonymous> (test\app\controller\system.setting.storeWarehouse.test.js:300:14)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.html
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.setting.storeWarehouse.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
93
test_reports/fail/016-main.md
Normal file
93
test_reports/fail/016-main.md
Normal file
@ -0,0 +1,93 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: main
|
||||
- 文件: test/app/controller/system.storage.entry.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (12ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (0ms)
|
||||
|
||||
|
||||
test/app/controller/system.storage.entry.test.js
|
||||
鉁?should query entry list (1104ms)
|
||||
1) should create entry and run detail lifecycle then cancel
|
||||
2) should complete entry after adding detail
|
||||
3) should reject invalid params for create/get/addDetail
|
||||
|
||||
|
||||
1 passing (4s)
|
||||
3 failing
|
||||
|
||||
1) test/app/controller/system.storage.entry.test.js
|
||||
should create entry and run detail lifecycle then cancel:
|
||||
|
||||
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
|
||||
|
||||
500 !== 200
|
||||
|
||||
+ expected - actual
|
||||
|
||||
-500
|
||||
+200
|
||||
|
||||
at Context.<anonymous> (test\app\controller\system.storage.entry.test.js:109:12)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
|
||||
2) test/app/controller/system.storage.entry.test.js
|
||||
should complete entry after adding detail:
|
||||
|
||||
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
|
||||
|
||||
500 !== 200
|
||||
|
||||
+ expected - actual
|
||||
|
||||
-500
|
||||
+200
|
||||
|
||||
at Context.<anonymous> (test\app\controller\system.storage.entry.test.js:181:12)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
|
||||
3) test/app/controller/system.storage.entry.test.js
|
||||
should reject invalid params for create/get/addDetail:
|
||||
|
||||
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
|
||||
|
||||
500 !== 200
|
||||
|
||||
+ expected - actual
|
||||
|
||||
-500
|
||||
+200
|
||||
|
||||
at Context.<anonymous> (test\app\controller\system.storage.entry.test.js:217:12)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.html
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.storage.entry.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
77
test_reports/fail/037-main.md
Normal file
77
test_reports/fail/037-main.md
Normal file
@ -0,0 +1,77 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: main
|
||||
- 文件: test/app/service/systems/notice.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (13ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (4ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (0ms)
|
||||
|
||||
|
||||
test/app/service/systems/notice.test.js
|
||||
1) should normalize payload and send only matching webhooks
|
||||
鉁?should enrich payload with store info from cache before querying database
|
||||
鉁?should load store info from database and cache it when cache is empty
|
||||
鉁?should send to both warehouse and owner webhooks when events match or are set to all
|
||||
鉁?should only send up to the configured webhook limit
|
||||
鉁?should require url for image or file message
|
||||
鉁?should require warehouseId but allow empty ownerId
|
||||
鉁?should retry failed webhooks three times and persist final failures
|
||||
鉁?should reject sending unregistered event
|
||||
鉁?should reject dotted or numeric-leading event names
|
||||
鉁?should send wecom webhook as enterprise wechat direct message
|
||||
鉁?should expose available webhook events and reject unsupported ones
|
||||
|
||||
|
||||
11 passing (15ms)
|
||||
1 failing
|
||||
|
||||
1) test/app/service/systems/notice.test.js
|
||||
should normalize payload and send only matching webhooks:
|
||||
|
||||
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
|
||||
+ actual - expected
|
||||
|
||||
+ 100000
|
||||
- 1000000
|
||||
|
||||
+ expected - actual
|
||||
|
||||
-100000
|
||||
+1000000
|
||||
|
||||
at Object.findAll (test\app\service\systems\notice.test.js:34:20)
|
||||
at D:\wms\app\service\systems\notice\index.js:796:43
|
||||
at Array.map (<anonymous>)
|
||||
at NoticeService.findMatchedWebhooks (app\service\systems\notice\index.js:786:62)
|
||||
at NoticeService.send (app\service\systems\notice\index.js:826:33)
|
||||
at async Context.<anonymous> (test\app\service\systems\notice.test.js:55:20)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.html
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/service/systems/notice.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
70
test_reports/fail/041-main.md
Normal file
70
test_reports/fail/041-main.md
Normal file
@ -0,0 +1,70 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: main
|
||||
- 文件: test/app/service/systems/storage.receiving.report.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (12ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (0ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (1ms)
|
||||
|
||||
|
||||
test/app/service/systems/storage.receiving.report.test.js
|
||||
1) should build and upload completion excel in a single sheet with one preview column
|
||||
鉁?should send receiving completed notice with the unified event payload
|
||||
鉁?should show only license plate for truck in notice content and report main rows
|
||||
鉁?should show only tracking number for express in notice content and report main rows
|
||||
鉁?should hide both contact fields for other delivery methods
|
||||
鉁?should support nested notice.index service shape from Egg loader
|
||||
鉁?should trigger text notice before excel and then send file notice after upload succeeds
|
||||
鉁?should only send text notice when completion excel generation fails
|
||||
鉁?should still complete and notify when detail has no matched product or completeness fields
|
||||
|
||||
|
||||
8 passing (24ms)
|
||||
1 failing
|
||||
|
||||
1) test/app/service/systems/storage.receiving.report.test.js
|
||||
should build and upload completion excel in a single sheet with one preview column:
|
||||
|
||||
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
|
||||
+ actual - expected
|
||||
|
||||
+ '鏀惰揣鏄庣粏(宸插畬鎴愭敹璐?_RCV202604040001.xlsx'
|
||||
- '鏀惰揣瀹屾垚_RCV202604040001.xlsx'
|
||||
^
|
||||
|
||||
+ expected - actual
|
||||
|
||||
-鏀惰揣鏄庣粏(宸插畬鎴愭敹璐?_RCV202604040001.xlsx
|
||||
+鏀惰揣瀹屾垚_RCV202604040001.xlsx
|
||||
|
||||
at Context.<anonymous> (test\app\service\systems\storage.receiving.report.test.js:260:12)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.html
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/service/systems/storage.receiving.report.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
149
test_reports/fail/044-mirror.md
Normal file
149
test_reports/fail/044-mirror.md
Normal file
@ -0,0 +1,149 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: mirror
|
||||
- 文件: test/app/controller/docs.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (13ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (4ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (1ms)
|
||||
|
||||
|
||||
1) "before all" hook: beforeAll in "{root}"
|
||||
2) "after all" hook: afterAll in "{root}"
|
||||
|
||||
0 passing (1s)
|
||||
2 failing
|
||||
|
||||
1) "before all" hook: beforeAll in "{root}":
|
||||
Error: Cannot find module './tencent-cloud'
|
||||
Require stack:
|
||||
- D:\wms\worktrees\deploy-20260409155126\config\config.default.js
|
||||
- D:\wms\node_modules\egg-core\lib\utils\index.js
|
||||
- D:\wms\node_modules\egg-core\lib\egg.js
|
||||
- D:\wms\node_modules\egg-core\index.js
|
||||
- D:\wms\node_modules\egg-mock\lib\context.js
|
||||
- D:\wms\node_modules\egg-mock\lib\app.js
|
||||
- D:\wms\node_modules\egg-mock\index.js
|
||||
- D:\wms\node_modules\egg-mock\register.js
|
||||
at Module._resolveFilename (node:internal/modules/cjs/loader:1456:15)
|
||||
at defaultResolveImpl (node:internal/modules/cjs/loader:1066:19)
|
||||
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1071:22)
|
||||
at Module._load (node:internal/modules/cjs/loader:1242:25)
|
||||
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
||||
at Module.require (node:internal/modules/cjs/loader:1556:12)
|
||||
at require (node:internal/modules/helpers:152:16)
|
||||
at module.exports (config\config.default.js:21:30)
|
||||
at AgentWorkerLoader.loadFile (D:\wms\node_modules\egg-core\lib\loader\egg_loader.js:315:13)
|
||||
at AgentWorkerLoader._loadConfig (D:\wms\node_modules\egg-core\lib\loader\mixin\config.js:82:25)
|
||||
at AgentWorkerLoader._preloadAppConfig (D:\wms\node_modules\egg-core\lib\loader\mixin\config.js:67:27)
|
||||
at AgentWorkerLoader.loadConfig (D:\wms\node_modules\egg-core\lib\loader\mixin\config.js:25:28)
|
||||
at AgentWorkerLoader.loadConfig (D:\wms\node_modules\egg\lib\loader\agent_worker_loader.js:16:11)
|
||||
at new EggApplication (D:\wms\node_modules\egg\lib\egg.js:62:17)
|
||||
at new Agent (D:\wms\node_modules\egg\lib\agent.js:22:5)
|
||||
at [init] (D:\wms\node_modules\egg-mock\lib\app.js:81:33)
|
||||
at Generator.next (<anonymous>)
|
||||
at onFulfilled (D:\wms\node_modules\co\index.js:65:19)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
|
||||
2) "after all" hook: afterAll in "{root}":
|
||||
Error: Cannot find module './tencent-cloud'
|
||||
Require stack:
|
||||
- D:\wms\worktrees\deploy-20260409155126\config\config.default.js
|
||||
- D:\wms\node_modules\egg-core\lib\utils\index.js
|
||||
- D:\wms\node_modules\egg-core\lib\egg.js
|
||||
- D:\wms\node_modules\egg-core\index.js
|
||||
- D:\wms\node_modules\egg-mock\lib\context.js
|
||||
- D:\wms\node_modules\egg-mock\lib\app.js
|
||||
- D:\wms\node_modules\egg-mock\index.js
|
||||
- D:\wms\node_modules\egg-mock\register.js
|
||||
at Module._resolveFilename (node:internal/modules/cjs/loader:1456:15)
|
||||
at defaultResolveImpl (node:internal/modules/cjs/loader:1066:19)
|
||||
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1071:22)
|
||||
at Module._load (node:internal/modules/cjs/loader:1242:25)
|
||||
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
||||
at Module.require (node:internal/modules/cjs/loader:1556:12)
|
||||
at require (node:internal/modules/helpers:152:16)
|
||||
at module.exports (config\config.default.js:21:30)
|
||||
at AgentWorkerLoader.loadFile (D:\wms\node_modules\egg-core\lib\loader\egg_loader.js:315:13)
|
||||
at AgentWorkerLoader._loadConfig (D:\wms\node_modules\egg-core\lib\loader\mixin\config.js:82:25)
|
||||
at AgentWorkerLoader._preloadAppConfig (D:\wms\node_modules\egg-core\lib\loader\mixin\config.js:67:27)
|
||||
at AgentWorkerLoader.loadConfig (D:\wms\node_modules\egg-core\lib\loader\mixin\config.js:25:28)
|
||||
at AgentWorkerLoader.loadConfig (D:\wms\node_modules\egg\lib\loader\agent_worker_loader.js:16:11)
|
||||
at new EggApplication (D:\wms\node_modules\egg\lib\egg.js:62:17)
|
||||
at new Agent (D:\wms\node_modules\egg\lib\agent.js:22:5)
|
||||
at [init] (D:\wms\node_modules\egg-mock\lib\app.js:81:33)
|
||||
at Generator.next (<anonymous>)
|
||||
at onFulfilled (D:\wms\node_modules\co\index.js:65:19)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\worktrees\deploy-20260409155126\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\worktrees\deploy-20260409155126\node_modules\.mochawesome-reports\mochawesome.html
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
2026-04-10 16:50:06,662 ERROR 3304 nodejs.MODULE_NOT_FOUNDError: Cannot find module './tencent-cloud'
|
||||
Require stack:
|
||||
- D:\wms\worktrees\deploy-20260409155126\config\config.default.js
|
||||
- D:\wms\node_modules\egg-core\lib\utils\index.js
|
||||
- D:\wms\node_modules\egg-core\lib\egg.js
|
||||
- D:\wms\node_modules\egg-core\index.js
|
||||
- D:\wms\node_modules\egg-mock\lib\context.js
|
||||
- D:\wms\node_modules\egg-mock\lib\app.js
|
||||
- D:\wms\node_modules\egg-mock\index.js
|
||||
- D:\wms\node_modules\egg-mock\register.js
|
||||
Require stack:
|
||||
- D:\wms\worktrees\deploy-20260409155126\config\config.default.js
|
||||
- D:\wms\node_modules\egg-core\lib\utils\index.js
|
||||
- D:\wms\node_modules\egg-core\lib\egg.js
|
||||
- D:\wms\node_modules\egg-core\index.js
|
||||
- D:\wms\node_modules\egg-mock\lib\context.js
|
||||
- D:\wms\node_modules\egg-mock\lib\app.js
|
||||
- D:\wms\node_modules\egg-mock\index.js
|
||||
- D:\wms\node_modules\egg-mock\register.js
|
||||
at Module._resolveFilename (node:internal/modules/cjs/loader:1456:15)
|
||||
at defaultResolveImpl (node:internal/modules/cjs/loader:1066:19)
|
||||
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1071:22)
|
||||
at Module._load (node:internal/modules/cjs/loader:1242:25)
|
||||
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
||||
at Module.require (node:internal/modules/cjs/loader:1556:12)
|
||||
at require (node:internal/modules/helpers:152:16)
|
||||
at module.exports (D:\wms\worktrees\deploy-20260409155126\config\config.default.js:21:30)
|
||||
at AgentWorkerLoader.loadFile (D:\wms\node_modules\egg-core\lib\loader\egg_loader.js:315:13)
|
||||
at AgentWorkerLoader._loadConfig (D:\wms\node_modules\egg-core\lib\loader\mixin\config.js:82:25)
|
||||
at AgentWorkerLoader._preloadAppConfig (D:\wms\node_modules\egg-core\lib\loader\mixin\config.js:67:27)
|
||||
at AgentWorkerLoader.loadConfig (D:\wms\node_modules\egg-core\lib\loader\mixin\config.js:25:28)
|
||||
at AgentWorkerLoader.loadConfig (D:\wms\node_modules\egg\lib\loader\agent_worker_loader.js:16:11)
|
||||
at new EggApplication (D:\wms\node_modules\egg\lib\egg.js:62:17)
|
||||
at new Agent (D:\wms\node_modules\egg\lib\agent.js:22:5)
|
||||
at [init] (D:\wms\node_modules\egg-mock\lib\app.js:81:33)
|
||||
at Generator.next (<anonymous>)
|
||||
at onFulfilled (D:\wms\node_modules\co\index.js:65:19)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
code: "MODULE_NOT_FOUND"
|
||||
requireStack: ["D:\\wms\\worktrees\\deploy-20260409155126\\config\\config.default.js","D:\\wms\\node_modules\\egg-core\\lib\\utils\\index.js","D:\\wms\\node_modules\\egg-core\\lib\\egg.js","D:\\wms\\node_modules\\egg-core\\index.js","D:\\wms\\node_modules\\egg-mock\\lib\\context.js","D:\\wms\\node_modules\\egg-mock\\lib\\app.js","D:\\wms\\node_modules\\egg-mock\\index.js","D:\\wms\\node_modules\\egg-mock\\register.js"]
|
||||
pid: 3304
|
||||
hostname: MINGREN
|
||||
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/docs.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
55
test_reports/fail/045-mirror.md
Normal file
55
test_reports/fail/045-mirror.md
Normal file
@ -0,0 +1,55 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: mirror
|
||||
- 文件: test/app/controller/gateway.user.bindAccountByTempCode.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (15ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (5ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (1ms)
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
|
||||
Exception during run: AssertionError [ERR_ASSERTION]: SYSTEM_TEST_YE4S_USER_ID 蹇呴』鏄惧紡鎻愪緵涓斾负姝f暣鏁? at Object.<anonymous> (D:\wms\worktrees\deploy-20260409155126\test\app\controller\gateway.user.bindAccountByTempCode.test.js:12:8)
|
||||
at Module._compile (node:internal/modules/cjs/loader:1812:14)
|
||||
at Object..js (node:internal/modules/cjs/loader:1943:10)
|
||||
at Module.load (node:internal/modules/cjs/loader:1533:32)
|
||||
at Module._load (node:internal/modules/cjs/loader:1335:12)
|
||||
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
||||
at loadCJSModuleWithModuleLoad (node:internal/modules/esm/translators:328:3)
|
||||
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:233:7)
|
||||
at ModuleJob.run (node:internal/modules/esm/module_job:430:25)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:661:26)
|
||||
at async formattedImport (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:9:14)
|
||||
at async exports.requireOrImport (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:42:28)
|
||||
at async exports.loadFilesAsync (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:100:20)
|
||||
at async singleRun (D:\wms\node_modules\mocha\lib\cli\run-helpers.js:162:3)
|
||||
at async exports.handler (D:\wms\node_modules\mocha\lib\cli\run.js:375:5) {
|
||||
generatedMessage: false,
|
||||
code: 'ERR_ASSERTION',
|
||||
actual: false,
|
||||
expected: true,
|
||||
operator: '==',
|
||||
diff: 'simple'
|
||||
}
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/gateway.user.bindAccountByTempCode.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
149
test_reports/fail/046-mirror.md
Normal file
149
test_reports/fail/046-mirror.md
Normal file
@ -0,0 +1,149 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: mirror
|
||||
- 文件: test/app/controller/home.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (13ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (0ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (4ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (1ms)
|
||||
|
||||
|
||||
1) "before all" hook: beforeAll in "{root}"
|
||||
2) "after all" hook: afterAll in "{root}"
|
||||
|
||||
0 passing (1s)
|
||||
2 failing
|
||||
|
||||
1) "before all" hook: beforeAll in "{root}":
|
||||
Error: Cannot find module './tencent-cloud'
|
||||
Require stack:
|
||||
- D:\wms\worktrees\deploy-20260409155126\config\config.default.js
|
||||
- D:\wms\node_modules\egg-core\lib\utils\index.js
|
||||
- D:\wms\node_modules\egg-core\lib\egg.js
|
||||
- D:\wms\node_modules\egg-core\index.js
|
||||
- D:\wms\node_modules\egg-mock\lib\context.js
|
||||
- D:\wms\node_modules\egg-mock\lib\app.js
|
||||
- D:\wms\node_modules\egg-mock\index.js
|
||||
- D:\wms\node_modules\egg-mock\register.js
|
||||
at Module._resolveFilename (node:internal/modules/cjs/loader:1456:15)
|
||||
at defaultResolveImpl (node:internal/modules/cjs/loader:1066:19)
|
||||
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1071:22)
|
||||
at Module._load (node:internal/modules/cjs/loader:1242:25)
|
||||
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
||||
at Module.require (node:internal/modules/cjs/loader:1556:12)
|
||||
at require (node:internal/modules/helpers:152:16)
|
||||
at module.exports (config\config.default.js:21:30)
|
||||
at AgentWorkerLoader.loadFile (D:\wms\node_modules\egg-core\lib\loader\egg_loader.js:315:13)
|
||||
at AgentWorkerLoader._loadConfig (D:\wms\node_modules\egg-core\lib\loader\mixin\config.js:82:25)
|
||||
at AgentWorkerLoader._preloadAppConfig (D:\wms\node_modules\egg-core\lib\loader\mixin\config.js:67:27)
|
||||
at AgentWorkerLoader.loadConfig (D:\wms\node_modules\egg-core\lib\loader\mixin\config.js:25:28)
|
||||
at AgentWorkerLoader.loadConfig (D:\wms\node_modules\egg\lib\loader\agent_worker_loader.js:16:11)
|
||||
at new EggApplication (D:\wms\node_modules\egg\lib\egg.js:62:17)
|
||||
at new Agent (D:\wms\node_modules\egg\lib\agent.js:22:5)
|
||||
at [init] (D:\wms\node_modules\egg-mock\lib\app.js:81:33)
|
||||
at Generator.next (<anonymous>)
|
||||
at onFulfilled (D:\wms\node_modules\co\index.js:65:19)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
|
||||
2) "after all" hook: afterAll in "{root}":
|
||||
Error: Cannot find module './tencent-cloud'
|
||||
Require stack:
|
||||
- D:\wms\worktrees\deploy-20260409155126\config\config.default.js
|
||||
- D:\wms\node_modules\egg-core\lib\utils\index.js
|
||||
- D:\wms\node_modules\egg-core\lib\egg.js
|
||||
- D:\wms\node_modules\egg-core\index.js
|
||||
- D:\wms\node_modules\egg-mock\lib\context.js
|
||||
- D:\wms\node_modules\egg-mock\lib\app.js
|
||||
- D:\wms\node_modules\egg-mock\index.js
|
||||
- D:\wms\node_modules\egg-mock\register.js
|
||||
at Module._resolveFilename (node:internal/modules/cjs/loader:1456:15)
|
||||
at defaultResolveImpl (node:internal/modules/cjs/loader:1066:19)
|
||||
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1071:22)
|
||||
at Module._load (node:internal/modules/cjs/loader:1242:25)
|
||||
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
||||
at Module.require (node:internal/modules/cjs/loader:1556:12)
|
||||
at require (node:internal/modules/helpers:152:16)
|
||||
at module.exports (config\config.default.js:21:30)
|
||||
at AgentWorkerLoader.loadFile (D:\wms\node_modules\egg-core\lib\loader\egg_loader.js:315:13)
|
||||
at AgentWorkerLoader._loadConfig (D:\wms\node_modules\egg-core\lib\loader\mixin\config.js:82:25)
|
||||
at AgentWorkerLoader._preloadAppConfig (D:\wms\node_modules\egg-core\lib\loader\mixin\config.js:67:27)
|
||||
at AgentWorkerLoader.loadConfig (D:\wms\node_modules\egg-core\lib\loader\mixin\config.js:25:28)
|
||||
at AgentWorkerLoader.loadConfig (D:\wms\node_modules\egg\lib\loader\agent_worker_loader.js:16:11)
|
||||
at new EggApplication (D:\wms\node_modules\egg\lib\egg.js:62:17)
|
||||
at new Agent (D:\wms\node_modules\egg\lib\agent.js:22:5)
|
||||
at [init] (D:\wms\node_modules\egg-mock\lib\app.js:81:33)
|
||||
at Generator.next (<anonymous>)
|
||||
at onFulfilled (D:\wms\node_modules\co\index.js:65:19)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\worktrees\deploy-20260409155126\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\worktrees\deploy-20260409155126\node_modules\.mochawesome-reports\mochawesome.html
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
2026-04-10 16:50:12,077 ERROR 11992 nodejs.MODULE_NOT_FOUNDError: Cannot find module './tencent-cloud'
|
||||
Require stack:
|
||||
- D:\wms\worktrees\deploy-20260409155126\config\config.default.js
|
||||
- D:\wms\node_modules\egg-core\lib\utils\index.js
|
||||
- D:\wms\node_modules\egg-core\lib\egg.js
|
||||
- D:\wms\node_modules\egg-core\index.js
|
||||
- D:\wms\node_modules\egg-mock\lib\context.js
|
||||
- D:\wms\node_modules\egg-mock\lib\app.js
|
||||
- D:\wms\node_modules\egg-mock\index.js
|
||||
- D:\wms\node_modules\egg-mock\register.js
|
||||
Require stack:
|
||||
- D:\wms\worktrees\deploy-20260409155126\config\config.default.js
|
||||
- D:\wms\node_modules\egg-core\lib\utils\index.js
|
||||
- D:\wms\node_modules\egg-core\lib\egg.js
|
||||
- D:\wms\node_modules\egg-core\index.js
|
||||
- D:\wms\node_modules\egg-mock\lib\context.js
|
||||
- D:\wms\node_modules\egg-mock\lib\app.js
|
||||
- D:\wms\node_modules\egg-mock\index.js
|
||||
- D:\wms\node_modules\egg-mock\register.js
|
||||
at Module._resolveFilename (node:internal/modules/cjs/loader:1456:15)
|
||||
at defaultResolveImpl (node:internal/modules/cjs/loader:1066:19)
|
||||
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1071:22)
|
||||
at Module._load (node:internal/modules/cjs/loader:1242:25)
|
||||
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
||||
at Module.require (node:internal/modules/cjs/loader:1556:12)
|
||||
at require (node:internal/modules/helpers:152:16)
|
||||
at module.exports (D:\wms\worktrees\deploy-20260409155126\config\config.default.js:21:30)
|
||||
at AgentWorkerLoader.loadFile (D:\wms\node_modules\egg-core\lib\loader\egg_loader.js:315:13)
|
||||
at AgentWorkerLoader._loadConfig (D:\wms\node_modules\egg-core\lib\loader\mixin\config.js:82:25)
|
||||
at AgentWorkerLoader._preloadAppConfig (D:\wms\node_modules\egg-core\lib\loader\mixin\config.js:67:27)
|
||||
at AgentWorkerLoader.loadConfig (D:\wms\node_modules\egg-core\lib\loader\mixin\config.js:25:28)
|
||||
at AgentWorkerLoader.loadConfig (D:\wms\node_modules\egg\lib\loader\agent_worker_loader.js:16:11)
|
||||
at new EggApplication (D:\wms\node_modules\egg\lib\egg.js:62:17)
|
||||
at new Agent (D:\wms\node_modules\egg\lib\agent.js:22:5)
|
||||
at [init] (D:\wms\node_modules\egg-mock\lib\app.js:81:33)
|
||||
at Generator.next (<anonymous>)
|
||||
at onFulfilled (D:\wms\node_modules\co\index.js:65:19)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
code: "MODULE_NOT_FOUND"
|
||||
requireStack: ["D:\\wms\\worktrees\\deploy-20260409155126\\config\\config.default.js","D:\\wms\\node_modules\\egg-core\\lib\\utils\\index.js","D:\\wms\\node_modules\\egg-core\\lib\\egg.js","D:\\wms\\node_modules\\egg-core\\index.js","D:\\wms\\node_modules\\egg-mock\\lib\\context.js","D:\\wms\\node_modules\\egg-mock\\lib\\app.js","D:\\wms\\node_modules\\egg-mock\\index.js","D:\\wms\\node_modules\\egg-mock\\register.js"]
|
||||
pid: 11992
|
||||
hostname: MINGREN
|
||||
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/home.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
63
test_reports/fail/048-mirror.md
Normal file
63
test_reports/fail/048-mirror.md
Normal file
@ -0,0 +1,63 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: mirror
|
||||
- 文件: test/app/controller/system.order.namespaced.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (11ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (0ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (4ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (1ms)
|
||||
|
||||
|
||||
test/app/controller/system.order.namespaced.test.js
|
||||
鉁?should query all namespaced order lists (2175ms)
|
||||
1) should review order through namespaced method and restore status
|
||||
|
||||
|
||||
1 passing (4s)
|
||||
1 failing
|
||||
|
||||
1) test/app/controller/system.order.namespaced.test.js
|
||||
should review order through namespaced method and restore status:
|
||||
|
||||
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
|
||||
+ actual - expected
|
||||
|
||||
+ 'failure'
|
||||
- 'success'
|
||||
|
||||
+ expected - actual
|
||||
|
||||
-failure
|
||||
+success
|
||||
|
||||
at Context.<anonymous> (test\app\controller\system.order.namespaced.test.js:110:12)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\worktrees\deploy-20260409155126\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\worktrees\deploy-20260409155126\node_modules\.mochawesome-reports\mochawesome.html
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.order.namespaced.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
62
test_reports/fail/049-mirror.md
Normal file
62
test_reports/fail/049-mirror.md
Normal file
@ -0,0 +1,62 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: mirror
|
||||
- 文件: test/app/controller/system.order.reviewOrder.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (11ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (4ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (1ms)
|
||||
|
||||
|
||||
test/app/controller/system.order.reviewOrder.test.js
|
||||
1) should review order and restore inspection status
|
||||
|
||||
|
||||
0 passing (2s)
|
||||
1 failing
|
||||
|
||||
1) test/app/controller/system.order.reviewOrder.test.js
|
||||
should review order and restore inspection status:
|
||||
|
||||
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
|
||||
+ actual - expected
|
||||
|
||||
+ 'failure'
|
||||
- 'success'
|
||||
|
||||
+ expected - actual
|
||||
|
||||
-failure
|
||||
+success
|
||||
|
||||
at Context.<anonymous> (test\app\controller\system.order.reviewOrder.test.js:79:12)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\worktrees\deploy-20260409155126\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\worktrees\deploy-20260409155126\node_modules\.mochawesome-reports\mochawesome.html
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.order.reviewOrder.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
55
test_reports/fail/050-mirror.md
Normal file
55
test_reports/fail/050-mirror.md
Normal file
@ -0,0 +1,55 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: mirror
|
||||
- 文件: test/app/controller/system.setting.account.getBindWechatCode.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (10ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (0ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (4ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (1ms)
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
|
||||
Exception during run: AssertionError [ERR_ASSERTION]: SYSTEM_TEST_YE4S_USER_ID 蹇呴』鏄惧紡鎻愪緵涓斾负姝f暣鏁? at Object.<anonymous> (D:\wms\worktrees\deploy-20260409155126\test\app\controller\system.setting.account.getBindWechatCode.test.js:12:8)
|
||||
at Module._compile (node:internal/modules/cjs/loader:1812:14)
|
||||
at Object..js (node:internal/modules/cjs/loader:1943:10)
|
||||
at Module.load (node:internal/modules/cjs/loader:1533:32)
|
||||
at Module._load (node:internal/modules/cjs/loader:1335:12)
|
||||
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
||||
at loadCJSModuleWithModuleLoad (node:internal/modules/esm/translators:328:3)
|
||||
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:233:7)
|
||||
at ModuleJob.run (node:internal/modules/esm/module_job:430:25)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:661:26)
|
||||
at async formattedImport (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:9:14)
|
||||
at async exports.requireOrImport (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:42:28)
|
||||
at async exports.loadFilesAsync (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:100:20)
|
||||
at async singleRun (D:\wms\node_modules\mocha\lib\cli\run-helpers.js:162:3)
|
||||
at async exports.handler (D:\wms\node_modules\mocha\lib\cli\run.js:375:5) {
|
||||
generatedMessage: false,
|
||||
code: 'ERR_ASSERTION',
|
||||
actual: false,
|
||||
expected: true,
|
||||
operator: '==',
|
||||
diff: 'simple'
|
||||
}
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.setting.account.getBindWechatCode.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
57
test_reports/fail/051-mirror.md
Normal file
57
test_reports/fail/051-mirror.md
Normal file
@ -0,0 +1,57 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: mirror
|
||||
- 文件: test/app/controller/system.setting.account.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (13ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (5ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (0ms)
|
||||
|
||||
|
||||
test/app/controller/system.setting.account.test.js
|
||||
1) "before all" hook for "error-1 should reject add when real_name is reserved name"
|
||||
|
||||
|
||||
0 passing (80ms)
|
||||
1 failing
|
||||
|
||||
1) test/app/controller/system.setting.account.test.js
|
||||
"before all" hook for "error-1 should reject add when real_name is reserved name":
|
||||
|
||||
AssertionError [ERR_ASSERTION]: 宸叉湁鏂囦欢ID鏃犳晥
|
||||
+ expected - actual
|
||||
|
||||
-false
|
||||
+true
|
||||
|
||||
at Context.<anonymous> (test\app\controller\system.setting.account.test.js:91:12)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\worktrees\deploy-20260409155126\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\worktrees\deploy-20260409155126\node_modules\.mochawesome-reports\mochawesome.html
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.setting.account.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
58
test_reports/fail/052-mirror.md
Normal file
58
test_reports/fail/052-mirror.md
Normal file
@ -0,0 +1,58 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: mirror
|
||||
- 文件: test/app/controller/system.setting.permission.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (12ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (4ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (0ms)
|
||||
|
||||
|
||||
test/app/controller/system.setting.permission.test.js
|
||||
鉁?should expose setting.role.permission as alias of setting.permission.list (252ms)
|
||||
鉁?should include route presentation fields in permission list response (506ms)
|
||||
鉁?should show newly created permission in list for admin management (463ms)
|
||||
鉁?should reject permission update when target permission does not exist (59ms)
|
||||
1) should create then update then delete permission successfully
|
||||
鉁?should split deleted_ids and already_deleted_ids in mixed batch delete (745ms)
|
||||
鉁?should reject mixed delete when ids contain non-existent permission (387ms)
|
||||
|
||||
|
||||
6 passing (4s)
|
||||
1 failing
|
||||
|
||||
1) test/app/controller/system.setting.permission.test.js
|
||||
should create then update then delete permission successfully:
|
||||
TypeError: fetch failed
|
||||
|
||||
Caused by: Error: read ECONNRESET
|
||||
at TCP.onStreamRead (node:internal/stream_base_commons:216:20)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\worktrees\deploy-20260409155126\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\worktrees\deploy-20260409155126\node_modules\.mochawesome-reports\mochawesome.html
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.setting.permission.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
70
test_reports/fail/055-mirror.md
Normal file
70
test_reports/fail/055-mirror.md
Normal file
@ -0,0 +1,70 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: mirror
|
||||
- 文件: test/app/controller/system.setting.storeWarehouse.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (13ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (4ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (1ms)
|
||||
|
||||
|
||||
test/app/controller/system.setting.storeWarehouse.test.js
|
||||
鉁?should list store-warehouse contracts in current subject scope (155ms)
|
||||
鉁?should allow renaming current-side remask and reflect it in list display (886ms)
|
||||
鉁?should generate a temp code and support preview before confirmation (269ms)
|
||||
鉁?should only change use_status when unbinding (589ms)
|
||||
鉁?should allow warehouse side to save and get policy config on a contract (924ms)
|
||||
鉁?should reject unsupported policy config fields on a contract (269ms)
|
||||
1) should allow warehouse side to save, update and delete api config on a contract
|
||||
鉁?should reject sign when counterparty is missing (61ms)
|
||||
鉁?should reject unbind when no target relation is provided (117ms)
|
||||
|
||||
|
||||
8 passing (4s)
|
||||
1 failing
|
||||
|
||||
1) test/app/controller/system.setting.storeWarehouse.test.js
|
||||
should allow warehouse side to save, update and delete api config on a contract:
|
||||
|
||||
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
|
||||
+ actual - expected
|
||||
|
||||
+ 'failure'
|
||||
- 'success'
|
||||
|
||||
+ expected - actual
|
||||
|
||||
-failure
|
||||
+success
|
||||
|
||||
at Context.<anonymous> (test\app\controller\system.setting.storeWarehouse.test.js:300:14)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\worktrees\deploy-20260409155126\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\worktrees\deploy-20260409155126\node_modules\.mochawesome-reports\mochawesome.html
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.setting.storeWarehouse.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
101
test_reports/fail/058-mirror.md
Normal file
101
test_reports/fail/058-mirror.md
Normal file
@ -0,0 +1,101 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: mirror
|
||||
- 文件: test/app/controller/system.storage.delivery.module.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (12ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (4ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (0ms)
|
||||
|
||||
|
||||
test/app/controller/system.storage.delivery.module.test.js
|
||||
1) should return delivery list via storage.stockout.list
|
||||
2) should return placeholder failure via storage.stockout.toOrder
|
||||
3) should return item list via storage.stockout.listItems
|
||||
鉁?should not expose removed storage.entry detail methods (1219ms)
|
||||
|
||||
|
||||
1 passing (5s)
|
||||
3 failing
|
||||
|
||||
1) test/app/controller/system.storage.delivery.module.test.js
|
||||
should return delivery list via storage.stockout.list:
|
||||
|
||||
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
|
||||
+ actual - expected
|
||||
|
||||
+ 'failure'
|
||||
- 'success'
|
||||
|
||||
+ expected - actual
|
||||
|
||||
-failure
|
||||
+success
|
||||
|
||||
at Context.<anonymous> (test\app\controller\system.storage.delivery.module.test.js:171:12)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
|
||||
2) test/app/controller/system.storage.delivery.module.test.js
|
||||
should return placeholder failure via storage.stockout.toOrder:
|
||||
|
||||
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
|
||||
+ actual - expected
|
||||
|
||||
+ 'failure'
|
||||
- 'success'
|
||||
|
||||
+ expected - actual
|
||||
|
||||
-failure
|
||||
+success
|
||||
|
||||
at getFirstDelivery (test\app\controller\system.storage.delivery.module.test.js:95:10)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
at async Context.<anonymous> (test\app\controller\system.storage.delivery.module.test.js:184:22)
|
||||
|
||||
3) test/app/controller/system.storage.delivery.module.test.js
|
||||
should return item list via storage.stockout.listItems:
|
||||
|
||||
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
|
||||
+ actual - expected
|
||||
|
||||
+ 'failure'
|
||||
- 'success'
|
||||
|
||||
+ expected - actual
|
||||
|
||||
-failure
|
||||
+success
|
||||
|
||||
at getFirstDelivery (test\app\controller\system.storage.delivery.module.test.js:95:10)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
at async Context.<anonymous> (test\app\controller\system.storage.delivery.module.test.js:210:22)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\worktrees\deploy-20260409155126\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\worktrees\deploy-20260409155126\node_modules\.mochawesome-reports\mochawesome.html
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.storage.delivery.module.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
93
test_reports/fail/059-mirror.md
Normal file
93
test_reports/fail/059-mirror.md
Normal file
@ -0,0 +1,93 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: mirror
|
||||
- 文件: test/app/controller/system.storage.entry.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (12ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (0ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (4ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (0ms)
|
||||
|
||||
|
||||
test/app/controller/system.storage.entry.test.js
|
||||
鉁?should query entry list (1120ms)
|
||||
1) should create entry and run detail lifecycle then cancel
|
||||
2) should complete entry after adding detail
|
||||
3) should reject invalid params for create/get/addDetail
|
||||
|
||||
|
||||
1 passing (4s)
|
||||
3 failing
|
||||
|
||||
1) test/app/controller/system.storage.entry.test.js
|
||||
should create entry and run detail lifecycle then cancel:
|
||||
|
||||
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
|
||||
|
||||
500 !== 200
|
||||
|
||||
+ expected - actual
|
||||
|
||||
-500
|
||||
+200
|
||||
|
||||
at Context.<anonymous> (test\app\controller\system.storage.entry.test.js:109:12)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
|
||||
2) test/app/controller/system.storage.entry.test.js
|
||||
should complete entry after adding detail:
|
||||
|
||||
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
|
||||
|
||||
500 !== 200
|
||||
|
||||
+ expected - actual
|
||||
|
||||
-500
|
||||
+200
|
||||
|
||||
at Context.<anonymous> (test\app\controller\system.storage.entry.test.js:181:12)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
|
||||
3) test/app/controller/system.storage.entry.test.js
|
||||
should reject invalid params for create/get/addDetail:
|
||||
|
||||
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
|
||||
|
||||
500 !== 200
|
||||
|
||||
+ expected - actual
|
||||
|
||||
-500
|
||||
+200
|
||||
|
||||
at Context.<anonymous> (test\app\controller\system.storage.entry.test.js:217:12)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\worktrees\deploy-20260409155126\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\worktrees\deploy-20260409155126\node_modules\.mochawesome-reports\mochawesome.html
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.storage.entry.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
77
test_reports/fail/060-mirror.md
Normal file
77
test_reports/fail/060-mirror.md
Normal file
@ -0,0 +1,77 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: mirror
|
||||
- 文件: test/app/controller/system.storage.inventory.matchPutaway.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (13ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (0ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (0ms)
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
|
||||
Exception during run: Error: Cannot find module './tencent-cloud'
|
||||
Require stack:
|
||||
- D:\wms\worktrees\deploy-20260409155126\config\config.default.js
|
||||
- D:\wms\worktrees\deploy-20260409155126\database\config.js
|
||||
- D:\wms\worktrees\deploy-20260409155126\test\app\controller\system.storage.inventory.matchPutaway.test.js
|
||||
at Module._resolveFilename (node:internal/modules/cjs/loader:1456:15)
|
||||
at defaultResolveImpl (node:internal/modules/cjs/loader:1066:19)
|
||||
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1071:22)
|
||||
at Module._load (node:internal/modules/cjs/loader:1242:25)
|
||||
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
||||
at Module.require (node:internal/modules/cjs/loader:1556:12)
|
||||
at require (node:internal/modules/helpers:152:16)
|
||||
at module.exports (D:\wms\worktrees\deploy-20260409155126\config\config.default.js:21:30)
|
||||
at loadEggConfig (D:\wms\worktrees\deploy-20260409155126\database\config.js:36:7)
|
||||
at Object.<anonymous> (D:\wms\worktrees\deploy-20260409155126\database\config.js:56:23)
|
||||
at Module._compile (node:internal/modules/cjs/loader:1812:14)
|
||||
at Object..js (node:internal/modules/cjs/loader:1943:10)
|
||||
at Module.load (node:internal/modules/cjs/loader:1533:32)
|
||||
at Module._load (node:internal/modules/cjs/loader:1335:12)
|
||||
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
||||
at Module.require (node:internal/modules/cjs/loader:1556:12)
|
||||
at require (node:internal/modules/helpers:152:16)
|
||||
at Object.<anonymous> (D:\wms\worktrees\deploy-20260409155126\test\app\controller\system.storage.inventory.matchPutaway.test.js:16:18)
|
||||
at Module._compile (node:internal/modules/cjs/loader:1812:14)
|
||||
at Object..js (node:internal/modules/cjs/loader:1943:10)
|
||||
at Module.load (node:internal/modules/cjs/loader:1533:32)
|
||||
at Module._load (node:internal/modules/cjs/loader:1335:12)
|
||||
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
||||
at loadCJSModuleWithModuleLoad (node:internal/modules/esm/translators:328:3)
|
||||
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:233:7)
|
||||
at ModuleJob.run (node:internal/modules/esm/module_job:430:25)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:661:26)
|
||||
at async formattedImport (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:9:14)
|
||||
at async exports.requireOrImport (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:42:28)
|
||||
at async exports.loadFilesAsync (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:100:20)
|
||||
at async singleRun (D:\wms\node_modules\mocha\lib\cli\run-helpers.js:162:3)
|
||||
at async exports.handler (D:\wms\node_modules\mocha\lib\cli\run.js:375:5) {
|
||||
code: 'MODULE_NOT_FOUND',
|
||||
requireStack: [
|
||||
'D:\\wms\\worktrees\\deploy-20260409155126\\config\\config.default.js',
|
||||
'D:\\wms\\worktrees\\deploy-20260409155126\\database\\config.js',
|
||||
'D:\\wms\\worktrees\\deploy-20260409155126\\test\\app\\controller\\system.storage.inventory.matchPutaway.test.js'
|
||||
]
|
||||
}
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.storage.inventory.matchPutaway.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
77
test_reports/fail/061-mirror.md
Normal file
77
test_reports/fail/061-mirror.md
Normal file
@ -0,0 +1,77 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: mirror
|
||||
- 文件: test/app/controller/system.storage.inventory.quickPutaway.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (12ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (0ms)
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
|
||||
Exception during run: Error: Cannot find module './tencent-cloud'
|
||||
Require stack:
|
||||
- D:\wms\worktrees\deploy-20260409155126\config\config.default.js
|
||||
- D:\wms\worktrees\deploy-20260409155126\database\config.js
|
||||
- D:\wms\worktrees\deploy-20260409155126\test\app\controller\system.storage.inventory.quickPutaway.test.js
|
||||
at Module._resolveFilename (node:internal/modules/cjs/loader:1456:15)
|
||||
at defaultResolveImpl (node:internal/modules/cjs/loader:1066:19)
|
||||
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1071:22)
|
||||
at Module._load (node:internal/modules/cjs/loader:1242:25)
|
||||
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
||||
at Module.require (node:internal/modules/cjs/loader:1556:12)
|
||||
at require (node:internal/modules/helpers:152:16)
|
||||
at module.exports (D:\wms\worktrees\deploy-20260409155126\config\config.default.js:21:30)
|
||||
at loadEggConfig (D:\wms\worktrees\deploy-20260409155126\database\config.js:36:7)
|
||||
at Object.<anonymous> (D:\wms\worktrees\deploy-20260409155126\database\config.js:56:23)
|
||||
at Module._compile (node:internal/modules/cjs/loader:1812:14)
|
||||
at Object..js (node:internal/modules/cjs/loader:1943:10)
|
||||
at Module.load (node:internal/modules/cjs/loader:1533:32)
|
||||
at Module._load (node:internal/modules/cjs/loader:1335:12)
|
||||
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
||||
at Module.require (node:internal/modules/cjs/loader:1556:12)
|
||||
at require (node:internal/modules/helpers:152:16)
|
||||
at Object.<anonymous> (D:\wms\worktrees\deploy-20260409155126\test\app\controller\system.storage.inventory.quickPutaway.test.js:16:18)
|
||||
at Module._compile (node:internal/modules/cjs/loader:1812:14)
|
||||
at Object..js (node:internal/modules/cjs/loader:1943:10)
|
||||
at Module.load (node:internal/modules/cjs/loader:1533:32)
|
||||
at Module._load (node:internal/modules/cjs/loader:1335:12)
|
||||
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
||||
at loadCJSModuleWithModuleLoad (node:internal/modules/esm/translators:328:3)
|
||||
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:233:7)
|
||||
at ModuleJob.run (node:internal/modules/esm/module_job:430:25)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:661:26)
|
||||
at async formattedImport (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:9:14)
|
||||
at async exports.requireOrImport (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:42:28)
|
||||
at async exports.loadFilesAsync (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:100:20)
|
||||
at async singleRun (D:\wms\node_modules\mocha\lib\cli\run-helpers.js:162:3)
|
||||
at async exports.handler (D:\wms\node_modules\mocha\lib\cli\run.js:375:5) {
|
||||
code: 'MODULE_NOT_FOUND',
|
||||
requireStack: [
|
||||
'D:\\wms\\worktrees\\deploy-20260409155126\\config\\config.default.js',
|
||||
'D:\\wms\\worktrees\\deploy-20260409155126\\database\\config.js',
|
||||
'D:\\wms\\worktrees\\deploy-20260409155126\\test\\app\\controller\\system.storage.inventory.quickPutaway.test.js'
|
||||
]
|
||||
}
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.storage.inventory.quickPutaway.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
62
test_reports/fail/062-mirror.md
Normal file
62
test_reports/fail/062-mirror.md
Normal file
@ -0,0 +1,62 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: mirror
|
||||
- 文件: test/app/controller/system.storage.receiving.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (12ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (4ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (1ms)
|
||||
|
||||
|
||||
test/app/controller/system.storage.receiving.test.js
|
||||
鉁?should query receiving list (1108ms)
|
||||
鉁?should query receiving detail when list has records (1254ms)
|
||||
1) should bind store to receiving and reject rebinding when owner already exists
|
||||
鉁?should reject bindStore when receiving is cancelled (2100ms)
|
||||
鉁?should bind and rebind system product for a receiving detail (2642ms)
|
||||
鉁?should create and then batch cancel receiving order (1323ms)
|
||||
鉁?should generate unique receiving numbers under concurrent create requests (1364ms)
|
||||
鉁?should include same-day records when created_at uses daterange filter (1353ms)
|
||||
鉁?should reject getReceivingDetail with invalid id (1035ms)
|
||||
鉁?should reject create with invalid loading_method enum (1061ms)
|
||||
鉁?should reject batchCancelReceiving with nonexistent ids (1044ms)
|
||||
|
||||
|
||||
10 passing (15s)
|
||||
1 failing
|
||||
|
||||
1) test/app/controller/system.storage.receiving.test.js
|
||||
should bind store to receiving and reject rebinding when owner already exists:
|
||||
TypeError: fetch failed
|
||||
|
||||
Caused by: Error: read ECONNRESET
|
||||
at TCP.onStreamRead (node:internal/stream_base_commons:216:20)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\worktrees\deploy-20260409155126\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\worktrees\deploy-20260409155126\node_modules\.mochawesome-reports\mochawesome.html
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.storage.receiving.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
77
test_reports/fail/063-mirror.md
Normal file
77
test_reports/fail/063-mirror.md
Normal file
@ -0,0 +1,77 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: mirror
|
||||
- 文件: test/app/controller/system.storage.transaction.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (12ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (0ms)
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
|
||||
Exception during run: Error: Cannot find module './tencent-cloud'
|
||||
Require stack:
|
||||
- D:\wms\worktrees\deploy-20260409155126\config\config.default.js
|
||||
- D:\wms\worktrees\deploy-20260409155126\database\config.js
|
||||
- D:\wms\worktrees\deploy-20260409155126\test\app\controller\system.storage.transaction.test.js
|
||||
at Module._resolveFilename (node:internal/modules/cjs/loader:1456:15)
|
||||
at defaultResolveImpl (node:internal/modules/cjs/loader:1066:19)
|
||||
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1071:22)
|
||||
at Module._load (node:internal/modules/cjs/loader:1242:25)
|
||||
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
||||
at Module.require (node:internal/modules/cjs/loader:1556:12)
|
||||
at require (node:internal/modules/helpers:152:16)
|
||||
at module.exports (D:\wms\worktrees\deploy-20260409155126\config\config.default.js:21:30)
|
||||
at loadEggConfig (D:\wms\worktrees\deploy-20260409155126\database\config.js:36:7)
|
||||
at Object.<anonymous> (D:\wms\worktrees\deploy-20260409155126\database\config.js:56:23)
|
||||
at Module._compile (node:internal/modules/cjs/loader:1812:14)
|
||||
at Object..js (node:internal/modules/cjs/loader:1943:10)
|
||||
at Module.load (node:internal/modules/cjs/loader:1533:32)
|
||||
at Module._load (node:internal/modules/cjs/loader:1335:12)
|
||||
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
||||
at Module.require (node:internal/modules/cjs/loader:1556:12)
|
||||
at require (node:internal/modules/helpers:152:16)
|
||||
at Object.<anonymous> (D:\wms\worktrees\deploy-20260409155126\test\app\controller\system.storage.transaction.test.js:16:18)
|
||||
at Module._compile (node:internal/modules/cjs/loader:1812:14)
|
||||
at Object..js (node:internal/modules/cjs/loader:1943:10)
|
||||
at Module.load (node:internal/modules/cjs/loader:1533:32)
|
||||
at Module._load (node:internal/modules/cjs/loader:1335:12)
|
||||
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
||||
at loadCJSModuleWithModuleLoad (node:internal/modules/esm/translators:328:3)
|
||||
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:233:7)
|
||||
at ModuleJob.run (node:internal/modules/esm/module_job:430:25)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:661:26)
|
||||
at async formattedImport (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:9:14)
|
||||
at async exports.requireOrImport (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:42:28)
|
||||
at async exports.loadFilesAsync (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:100:20)
|
||||
at async singleRun (D:\wms\node_modules\mocha\lib\cli\run-helpers.js:162:3)
|
||||
at async exports.handler (D:\wms\node_modules\mocha\lib\cli\run.js:375:5) {
|
||||
code: 'MODULE_NOT_FOUND',
|
||||
requireStack: [
|
||||
'D:\\wms\\worktrees\\deploy-20260409155126\\config\\config.default.js',
|
||||
'D:\\wms\\worktrees\\deploy-20260409155126\\database\\config.js',
|
||||
'D:\\wms\\worktrees\\deploy-20260409155126\\test\\app\\controller\\system.storage.transaction.test.js'
|
||||
]
|
||||
}
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.storage.transaction.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
56
test_reports/fail/076-mirror.md
Normal file
56
test_reports/fail/076-mirror.md
Normal file
@ -0,0 +1,56 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: mirror
|
||||
- 文件: test/app/service/systems/license_plate.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (12ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (0ms)
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
|
||||
Exception during run: Error: ENOENT: no such file or directory, open 'D:\wms\worktrees\deploy-20260409155126\temp\cp.png'
|
||||
at Object.openSync (node:fs:560:18)
|
||||
at Object.readFileSync (node:fs:444:35)
|
||||
at Object.<anonymous> (D:\wms\worktrees\deploy-20260409155126\test\app\service\systems\license_plate.test.js:9:31)
|
||||
at Module._compile (node:internal/modules/cjs/loader:1812:14)
|
||||
at Object..js (node:internal/modules/cjs/loader:1943:10)
|
||||
at Module.load (node:internal/modules/cjs/loader:1533:32)
|
||||
at Module._load (node:internal/modules/cjs/loader:1335:12)
|
||||
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
||||
at loadCJSModuleWithModuleLoad (node:internal/modules/esm/translators:328:3)
|
||||
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:233:7)
|
||||
at ModuleJob.run (node:internal/modules/esm/module_job:430:25)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:661:26)
|
||||
at async formattedImport (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:9:14)
|
||||
at async exports.requireOrImport (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:42:28)
|
||||
at async exports.loadFilesAsync (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:100:20)
|
||||
at async singleRun (D:\wms\node_modules\mocha\lib\cli\run-helpers.js:162:3)
|
||||
at async exports.handler (D:\wms\node_modules\mocha\lib\cli\run.js:375:5) {
|
||||
errno: -4058,
|
||||
code: 'ENOENT',
|
||||
syscall: 'open',
|
||||
path: 'D:\\wms\\worktrees\\deploy-20260409155126\\temp\\cp.png'
|
||||
}
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/service/systems/license_plate.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
77
test_reports/fail/077-mirror.md
Normal file
77
test_reports/fail/077-mirror.md
Normal file
@ -0,0 +1,77 @@
|
||||
# 测试结果
|
||||
|
||||
- 时间: 20260410-164555
|
||||
- 范围: mirror
|
||||
- 文件: test/app/service/systems/notice.test.js
|
||||
- 状态: fail
|
||||
- 退出码: 1
|
||||
|
||||
## 标准输出
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (12ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (0ms)
|
||||
|
||||
|
||||
test/app/service/systems/notice.test.js
|
||||
1) should normalize payload and send only matching webhooks
|
||||
鉁?should enrich payload with store info from cache before querying database
|
||||
鉁?should load store info from database and cache it when cache is empty
|
||||
鉁?should send to both warehouse and owner webhooks when events match or are set to all
|
||||
鉁?should only send up to the configured webhook limit
|
||||
鉁?should require url for image or file message
|
||||
鉁?should require warehouseId but allow empty ownerId
|
||||
鉁?should retry failed webhooks three times and persist final failures
|
||||
鉁?should reject sending unregistered event
|
||||
鉁?should reject dotted or numeric-leading event names
|
||||
鉁?should send wecom webhook as enterprise wechat direct message
|
||||
鉁?should expose available webhook events and reject unsupported ones
|
||||
|
||||
|
||||
11 passing (12ms)
|
||||
1 failing
|
||||
|
||||
1) test/app/service/systems/notice.test.js
|
||||
should normalize payload and send only matching webhooks:
|
||||
|
||||
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
|
||||
+ actual - expected
|
||||
|
||||
+ 100000
|
||||
- 1000000
|
||||
|
||||
+ expected - actual
|
||||
|
||||
-100000
|
||||
+1000000
|
||||
|
||||
at Object.findAll (test\app\service\systems\notice.test.js:34:20)
|
||||
at D:\wms\worktrees\deploy-20260409155126\app\service\systems\notice\index.js:796:43
|
||||
at Array.map (<anonymous>)
|
||||
at NoticeService.findMatchedWebhooks (app\service\systems\notice\index.js:786:62)
|
||||
at NoticeService.send (app\service\systems\notice\index.js:826:33)
|
||||
at async Context.<anonymous> (test\app\service\systems\notice.test.js:55:20)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\worktrees\deploy-20260409155126\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\worktrees\deploy-20260409155126\node_modules\.mochawesome-reports\mochawesome.html
|
||||
```
|
||||
|
||||
## 标准错误
|
||||
|
||||
```text
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/service/systems/notice.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
@ -0,0 +1,64 @@
|
||||
# 测试结果
|
||||
|
||||
- 状态: SKIP
|
||||
- 分类: 主区
|
||||
- 文件: app/controller/gateway.user.bindAccountByTempCode.test.js
|
||||
- 源: main
|
||||
- 测试类型: 自动化文件级执行
|
||||
- 测试账号: liufumingren
|
||||
- 测试仓 ID: 100000
|
||||
- 测试货主 ID: 1000000
|
||||
- 开始时间: 2026-04-10T13:04:24.171Z
|
||||
- 结束时间: 2026-04-10T13:04:25.661Z
|
||||
- 耗时(秒): 1
|
||||
- 退出码: 1
|
||||
- 说明: 环境/数据缺失: timeout
|
||||
|
||||
## 执行输出摘录
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (13ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (4ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (0ms)
|
||||
|
||||
|
||||
Exception during run: AssertionError [ERR_ASSERTION]: SYSTEM_TEST_YE4S_USER_ID 必须显式提供且为正整数
|
||||
at Object.<anonymous> (D:\wms\test\app\controller\gateway.user.bindAccountByTempCode.test.js:12:8)
|
||||
at Module._compile (node:internal/modules/cjs/loader:1812:14)
|
||||
at Object..js (node:internal/modules/cjs/loader:1943:10)
|
||||
at Module.load (node:internal/modules/cjs/loader:1533:32)
|
||||
at Module._load (node:internal/modules/cjs/loader:1335:12)
|
||||
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
||||
at loadCJSModuleWithModuleLoad (node:internal/modules/esm/translators:328:3)
|
||||
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:233:7)
|
||||
at ModuleJob.run (node:internal/modules/esm/module_job:430:25)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:661:26)
|
||||
at async formattedImport (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:9:14)
|
||||
at async exports.requireOrImport (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:42:28)
|
||||
at async exports.loadFilesAsync (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:100:20)
|
||||
at async singleRun (D:\wms\node_modules\mocha\lib\cli\run-helpers.js:162:3)
|
||||
at async exports.handler (D:\wms\node_modules\mocha\lib\cli\run.js:375:5) {
|
||||
generatedMessage: false,
|
||||
code: 'ERR_ASSERTION',
|
||||
actual: false,
|
||||
expected: true,
|
||||
operator: '==',
|
||||
diff: 'simple'
|
||||
}
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/gateway.user.bindAccountByTempCode.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
|
||||
## 执行错误
|
||||
|
||||
- 错误对象: (无)
|
||||
@ -0,0 +1,61 @@
|
||||
# 测试结果
|
||||
|
||||
- 状态: SKIP
|
||||
- 分类: 主区
|
||||
- 文件: app/controller/system.order.getreviewOrderlist.test.js
|
||||
- 源: main
|
||||
- 测试类型: 自动化文件级执行
|
||||
- 测试账号: liufumingren
|
||||
- 测试仓 ID: 100000
|
||||
- 测试货主 ID: 1000000
|
||||
- 开始时间: 2026-04-10T13:04:29.982Z
|
||||
- 结束时间: 2026-04-10T13:04:31.444Z
|
||||
- 耗时(秒): 1
|
||||
- 退出码: 1
|
||||
- 说明: 环境/数据缺失: ECONNREFUSED
|
||||
|
||||
## 执行输出摘录
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (13ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (4ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (1ms)
|
||||
|
||||
|
||||
test/app/controller/system.order.getreviewOrderlist.test.js
|
||||
1) should call order.getreviewOrderlist with platform=web project=all
|
||||
|
||||
|
||||
0 passing (18ms)
|
||||
1 failing
|
||||
|
||||
1) test/app/controller/system.order.getreviewOrderlist.test.js
|
||||
should call order.getreviewOrderlist with platform=web project=all:
|
||||
TypeError: fetch failed
|
||||
|
||||
Caused by: Error: connect ECONNREFUSED 127.0.0.1:6060
|
||||
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1645:16)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.html
|
||||
|
||||
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.order.getreviewOrderlist.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
|
||||
## 执行错误
|
||||
|
||||
- 错误对象: (无)
|
||||
@ -0,0 +1,77 @@
|
||||
# 测试结果
|
||||
|
||||
- 状态: SKIP
|
||||
- 分类: 主区
|
||||
- 文件: app/controller/system.order.namespaced.test.js
|
||||
- 源: main
|
||||
- 测试类型: 自动化文件级执行
|
||||
- 测试账号: liufumingren
|
||||
- 测试仓 ID: 100000
|
||||
- 测试货主 ID: 1000000
|
||||
- 开始时间: 2026-04-10T13:04:31.445Z
|
||||
- 结束时间: 2026-04-10T13:04:32.929Z
|
||||
- 耗时(秒): 1
|
||||
- 退出码: 1
|
||||
- 说明: 环境/数据缺失: ECONNREFUSED
|
||||
|
||||
## 执行输出摘录
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (12ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (1ms)
|
||||
|
||||
|
||||
test/app/controller/system.order.namespaced.test.js
|
||||
1) should query all namespaced order lists
|
||||
2) should review order through namespaced method and restore status
|
||||
3) should return audit_status in delivery orders and support filtering
|
||||
|
||||
|
||||
0 passing (25ms)
|
||||
3 failing
|
||||
|
||||
1) test/app/controller/system.order.namespaced.test.js
|
||||
should query all namespaced order lists:
|
||||
TypeError: fetch failed
|
||||
|
||||
Caused by: Error: connect ECONNREFUSED 127.0.0.1:6060
|
||||
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1645:16)
|
||||
|
||||
2) test/app/controller/system.order.namespaced.test.js
|
||||
should review order through namespaced method and restore status:
|
||||
TypeError: fetch failed
|
||||
|
||||
Caused by: Error: connect ECONNREFUSED 127.0.0.1:6060
|
||||
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1645:16)
|
||||
|
||||
3) test/app/controller/system.order.namespaced.test.js
|
||||
should return audit_status in delivery orders and support filtering:
|
||||
TypeError: fetch failed
|
||||
|
||||
Caused by: Error: connect ECONNREFUSED 127.0.0.1:6060
|
||||
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1645:16)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.html
|
||||
|
||||
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.order.namespaced.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
|
||||
## 执行错误
|
||||
|
||||
- 错误对象: (无)
|
||||
@ -0,0 +1,61 @@
|
||||
# 测试结果
|
||||
|
||||
- 状态: SKIP
|
||||
- 分类: 主区
|
||||
- 文件: app/controller/system.order.reviewOrder.test.js
|
||||
- 源: main
|
||||
- 测试类型: 自动化文件级执行
|
||||
- 测试账号: liufumingren
|
||||
- 测试仓 ID: 100000
|
||||
- 测试货主 ID: 1000000
|
||||
- 开始时间: 2026-04-10T13:04:32.929Z
|
||||
- 结束时间: 2026-04-10T13:04:34.410Z
|
||||
- 耗时(秒): 1
|
||||
- 退出码: 1
|
||||
- 说明: 环境/数据缺失: ECONNREFUSED
|
||||
|
||||
## 执行输出摘录
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (4ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (14ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (0ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (4ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (0ms)
|
||||
|
||||
|
||||
test/app/controller/system.order.reviewOrder.test.js
|
||||
1) should review order and restore inspection status
|
||||
|
||||
|
||||
0 passing (20ms)
|
||||
1 failing
|
||||
|
||||
1) test/app/controller/system.order.reviewOrder.test.js
|
||||
should review order and restore inspection status:
|
||||
TypeError: fetch failed
|
||||
|
||||
Caused by: Error: connect ECONNREFUSED 127.0.0.1:6060
|
||||
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1645:16)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.html
|
||||
|
||||
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.order.reviewOrder.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
|
||||
## 执行错误
|
||||
|
||||
- 错误对象: (无)
|
||||
@ -0,0 +1,64 @@
|
||||
# 测试结果
|
||||
|
||||
- 状态: SKIP
|
||||
- 分类: 主区
|
||||
- 文件: app/controller/system.setting.account.getBindWechatCode.test.js
|
||||
- 源: main
|
||||
- 测试类型: 自动化文件级执行
|
||||
- 测试账号: liufumingren
|
||||
- 测试仓 ID: 100000
|
||||
- 测试货主 ID: 1000000
|
||||
- 开始时间: 2026-04-10T13:04:34.411Z
|
||||
- 结束时间: 2026-04-10T13:04:35.878Z
|
||||
- 耗时(秒): 1
|
||||
- 退出码: 1
|
||||
- 说明: 环境/数据缺失: timeout
|
||||
|
||||
## 执行输出摘录
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (13ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (1ms)
|
||||
|
||||
|
||||
Exception during run: AssertionError [ERR_ASSERTION]: SYSTEM_TEST_YE4S_USER_ID 必须显式提供且为正整数
|
||||
at Object.<anonymous> (D:\wms\test\app\controller\system.setting.account.getBindWechatCode.test.js:12:8)
|
||||
at Module._compile (node:internal/modules/cjs/loader:1812:14)
|
||||
at Object..js (node:internal/modules/cjs/loader:1943:10)
|
||||
at Module.load (node:internal/modules/cjs/loader:1533:32)
|
||||
at Module._load (node:internal/modules/cjs/loader:1335:12)
|
||||
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
|
||||
at loadCJSModuleWithModuleLoad (node:internal/modules/esm/translators:328:3)
|
||||
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:233:7)
|
||||
at ModuleJob.run (node:internal/modules/esm/module_job:430:25)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
|
||||
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:661:26)
|
||||
at async formattedImport (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:9:14)
|
||||
at async exports.requireOrImport (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:42:28)
|
||||
at async exports.loadFilesAsync (D:\wms\node_modules\mocha\lib\nodejs\esm-utils.js:100:20)
|
||||
at async singleRun (D:\wms\node_modules\mocha\lib\cli\run-helpers.js:162:3)
|
||||
at async exports.handler (D:\wms\node_modules\mocha\lib\cli\run.js:375:5) {
|
||||
generatedMessage: false,
|
||||
code: 'ERR_ASSERTION',
|
||||
actual: false,
|
||||
expected: true,
|
||||
operator: '==',
|
||||
diff: 'simple'
|
||||
}
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.setting.account.getBindWechatCode.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
|
||||
## 执行错误
|
||||
|
||||
- 错误对象: (无)
|
||||
@ -0,0 +1,61 @@
|
||||
# 测试结果
|
||||
|
||||
- 状态: SKIP
|
||||
- 分类: 主区
|
||||
- 文件: app/controller/system.setting.account.test.js
|
||||
- 源: main
|
||||
- 测试类型: 自动化文件级执行
|
||||
- 测试账号: liufumingren
|
||||
- 测试仓 ID: 100000
|
||||
- 测试货主 ID: 1000000
|
||||
- 开始时间: 2026-04-10T13:04:35.879Z
|
||||
- 结束时间: 2026-04-10T13:04:37.367Z
|
||||
- 耗时(秒): 1
|
||||
- 退出码: 1
|
||||
- 说明: 环境/数据缺失: ECONNREFUSED
|
||||
|
||||
## 执行输出摘录
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (13ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (1ms)
|
||||
|
||||
|
||||
test/app/controller/system.setting.account.test.js
|
||||
1) "before all" hook for "error-1 should reject add when real_name is reserved name"
|
||||
|
||||
|
||||
0 passing (20ms)
|
||||
1 failing
|
||||
|
||||
1) test/app/controller/system.setting.account.test.js
|
||||
"before all" hook for "error-1 should reject add when real_name is reserved name":
|
||||
TypeError: fetch failed
|
||||
|
||||
Caused by: Error: connect ECONNREFUSED 127.0.0.1:6060
|
||||
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1645:16)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.html
|
||||
|
||||
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.setting.account.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
|
||||
## 执行错误
|
||||
|
||||
- 错误对象: (无)
|
||||
@ -0,0 +1,61 @@
|
||||
# 测试结果
|
||||
|
||||
- 状态: SKIP
|
||||
- 分类: 主区
|
||||
- 文件: app/controller/system.setting.permission.test.js
|
||||
- 源: main
|
||||
- 测试类型: 自动化文件级执行
|
||||
- 测试账号: liufumingren
|
||||
- 测试仓 ID: 100000
|
||||
- 测试货主 ID: 1000000
|
||||
- 开始时间: 2026-04-10T13:04:37.368Z
|
||||
- 结束时间: 2026-04-10T13:04:38.828Z
|
||||
- 耗时(秒): 1
|
||||
- 退出码: 1
|
||||
- 说明: 环境/数据缺失: ECONNREFUSED
|
||||
|
||||
## 执行输出摘录
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (12ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (0ms)
|
||||
|
||||
|
||||
test/app/controller/system.setting.permission.test.js
|
||||
1) "before all" hook for "should expose setting.role.permission as alias of setting.permission.list"
|
||||
|
||||
|
||||
0 passing (17ms)
|
||||
1 failing
|
||||
|
||||
1) test/app/controller/system.setting.permission.test.js
|
||||
"before all" hook for "should expose setting.role.permission as alias of setting.permission.list":
|
||||
TypeError: fetch failed
|
||||
|
||||
Caused by: Error: connect ECONNREFUSED 127.0.0.1:6060
|
||||
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1645:16)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.html
|
||||
|
||||
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.setting.permission.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
|
||||
## 执行错误
|
||||
|
||||
- 错误对象: (无)
|
||||
@ -0,0 +1,61 @@
|
||||
# 测试结果
|
||||
|
||||
- 状态: SKIP
|
||||
- 分类: 主区
|
||||
- 文件: app/controller/system.setting.printTemplate.test.js
|
||||
- 源: main
|
||||
- 测试类型: 自动化文件级执行
|
||||
- 测试账号: liufumingren
|
||||
- 测试仓 ID: 100000
|
||||
- 测试货主 ID: 1000000
|
||||
- 开始时间: 2026-04-10T13:04:38.829Z
|
||||
- 结束时间: 2026-04-10T13:04:40.275Z
|
||||
- 耗时(秒): 1
|
||||
- 退出码: 1
|
||||
- 说明: 环境/数据缺失: ECONNREFUSED
|
||||
|
||||
## 执行输出摘录
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (13ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (1ms)
|
||||
|
||||
|
||||
test/app/controller/system.setting.printTemplate.test.js
|
||||
1) "before all" hook for "normal-1 should create print template successfully"
|
||||
|
||||
|
||||
0 passing (18ms)
|
||||
1 failing
|
||||
|
||||
1) test/app/controller/system.setting.printTemplate.test.js
|
||||
"before all" hook for "normal-1 should create print template successfully":
|
||||
TypeError: fetch failed
|
||||
|
||||
Caused by: Error: connect ECONNREFUSED 127.0.0.1:6060
|
||||
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1645:16)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.html
|
||||
|
||||
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.setting.printTemplate.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
|
||||
## 执行错误
|
||||
|
||||
- 错误对象: (无)
|
||||
@ -0,0 +1,61 @@
|
||||
# 测试结果
|
||||
|
||||
- 状态: SKIP
|
||||
- 分类: 主区
|
||||
- 文件: app/controller/system.setting.role.test.js
|
||||
- 源: main
|
||||
- 测试类型: 自动化文件级执行
|
||||
- 测试账号: liufumingren
|
||||
- 测试仓 ID: 100000
|
||||
- 测试货主 ID: 1000000
|
||||
- 开始时间: 2026-04-10T13:04:40.276Z
|
||||
- 结束时间: 2026-04-10T13:04:41.764Z
|
||||
- 耗时(秒): 1
|
||||
- 退出码: 1
|
||||
- 说明: 环境/数据缺失: ECONNREFUSED
|
||||
|
||||
## 执行输出摘录
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (14ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (4ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (1ms)
|
||||
|
||||
|
||||
test/app/controller/system.setting.role.test.js
|
||||
1) "before all" hook for "should support wildcard role permissions via ["*"]"
|
||||
|
||||
|
||||
0 passing (18ms)
|
||||
1 failing
|
||||
|
||||
1) test/app/controller/system.setting.role.test.js
|
||||
"before all" hook for "should support wildcard role permissions via ["*"]":
|
||||
TypeError: fetch failed
|
||||
|
||||
Caused by: Error: connect ECONNREFUSED 127.0.0.1:6060
|
||||
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1645:16)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.html
|
||||
|
||||
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.setting.role.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
|
||||
## 执行错误
|
||||
|
||||
- 错误对象: (无)
|
||||
@ -0,0 +1,61 @@
|
||||
# 测试结果
|
||||
|
||||
- 状态: SKIP
|
||||
- 分类: 主区
|
||||
- 文件: app/controller/system.setting.storeWarehouse.test.js
|
||||
- 源: main
|
||||
- 测试类型: 自动化文件级执行
|
||||
- 测试账号: liufumingren
|
||||
- 测试仓 ID: 100000
|
||||
- 测试货主 ID: 1000000
|
||||
- 开始时间: 2026-04-10T13:04:41.764Z
|
||||
- 结束时间: 2026-04-10T13:04:43.267Z
|
||||
- 耗时(秒): 2
|
||||
- 退出码: 1
|
||||
- 说明: 环境/数据缺失: ECONNREFUSED
|
||||
|
||||
## 执行输出摘录
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (13ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (0ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (0ms)
|
||||
|
||||
|
||||
test/app/controller/system.setting.storeWarehouse.test.js
|
||||
1) "before all" hook for "should list store-warehouse contracts in current subject scope"
|
||||
|
||||
|
||||
0 passing (19ms)
|
||||
1 failing
|
||||
|
||||
1) test/app/controller/system.setting.storeWarehouse.test.js
|
||||
"before all" hook for "should list store-warehouse contracts in current subject scope":
|
||||
TypeError: fetch failed
|
||||
|
||||
Caused by: Error: connect ECONNREFUSED 127.0.0.1:6060
|
||||
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1645:16)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.html
|
||||
|
||||
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.setting.storeWarehouse.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
|
||||
## 执行错误
|
||||
|
||||
- 错误对象: (无)
|
||||
@ -0,0 +1,61 @@
|
||||
# 测试结果
|
||||
|
||||
- 状态: SKIP
|
||||
- 分类: 主区
|
||||
- 文件: app/controller/system.stock.warehouse.getStockDetail.test.js
|
||||
- 源: main
|
||||
- 测试类型: 自动化文件级执行
|
||||
- 测试账号: liufumingren
|
||||
- 测试仓 ID: 100000
|
||||
- 测试货主 ID: 1000000
|
||||
- 开始时间: 2026-04-10T13:04:43.267Z
|
||||
- 结束时间: 2026-04-10T13:04:44.751Z
|
||||
- 耗时(秒): 1
|
||||
- 退出码: 1
|
||||
- 说明: 环境/数据缺失: ECONNREFUSED
|
||||
|
||||
## 执行输出摘录
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (12ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (0ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (4ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (0ms)
|
||||
|
||||
|
||||
test/app/controller/system.stock.warehouse.getStockDetail.test.js
|
||||
1) "before all" hook for "should return stockItem, storageList and pagination for a valid stock_id"
|
||||
|
||||
|
||||
0 passing (18ms)
|
||||
1 failing
|
||||
|
||||
1) test/app/controller/system.stock.warehouse.getStockDetail.test.js
|
||||
"before all" hook for "should return stockItem, storageList and pagination for a valid stock_id":
|
||||
TypeError: fetch failed
|
||||
|
||||
Caused by: Error: connect ECONNREFUSED 127.0.0.1:6060
|
||||
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1645:16)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.html
|
||||
|
||||
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.stock.warehouse.getStockDetail.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
|
||||
## 执行错误
|
||||
|
||||
- 错误对象: (无)
|
||||
@ -0,0 +1,61 @@
|
||||
# 测试结果
|
||||
|
||||
- 状态: SKIP
|
||||
- 分类: 主区
|
||||
- 文件: app/controller/system.stock.warehouse.namespaced.test.js
|
||||
- 源: main
|
||||
- 测试类型: 自动化文件级执行
|
||||
- 测试账号: liufumingren
|
||||
- 测试仓 ID: 100000
|
||||
- 测试货主 ID: 1000000
|
||||
- 开始时间: 2026-04-10T13:04:44.751Z
|
||||
- 结束时间: 2026-04-10T13:04:46.259Z
|
||||
- 耗时(秒): 2
|
||||
- 退出码: 1
|
||||
- 说明: 环境/数据缺失: ECONNREFUSED
|
||||
|
||||
## 执行输出摘录
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (15ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (1ms)
|
||||
|
||||
|
||||
test/app/controller/system.stock.warehouse.namespaced.test.js
|
||||
1) should query stock warehouse list via namespaced method
|
||||
|
||||
|
||||
0 passing (19ms)
|
||||
1 failing
|
||||
|
||||
1) test/app/controller/system.stock.warehouse.namespaced.test.js
|
||||
should query stock warehouse list via namespaced method:
|
||||
TypeError: fetch failed
|
||||
|
||||
Caused by: Error: connect ECONNREFUSED 127.0.0.1:6060
|
||||
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1645:16)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.html
|
||||
|
||||
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.stock.warehouse.namespaced.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
|
||||
## 执行错误
|
||||
|
||||
- 错误对象: (无)
|
||||
@ -0,0 +1,85 @@
|
||||
# 测试结果
|
||||
|
||||
- 状态: SKIP
|
||||
- 分类: 主区
|
||||
- 文件: app/controller/system.storage.delivery.module.test.js
|
||||
- 源: main
|
||||
- 测试类型: 自动化文件级执行
|
||||
- 测试账号: liufumingren
|
||||
- 测试仓 ID: 100000
|
||||
- 测试货主 ID: 1000000
|
||||
- 开始时间: 2026-04-10T13:04:46.260Z
|
||||
- 结束时间: 2026-04-10T13:04:47.734Z
|
||||
- 耗时(秒): 1
|
||||
- 退出码: 1
|
||||
- 说明: 环境/数据缺失: ECONNREFUSED
|
||||
|
||||
## 执行输出摘录
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (13ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (0ms)
|
||||
|
||||
|
||||
test/app/controller/system.storage.delivery.module.test.js
|
||||
1) should return delivery list via storage.stockout.list
|
||||
2) should return placeholder failure via storage.stockout.toOrder
|
||||
3) should return item list via storage.stockout.listItems
|
||||
4) should not expose removed storage.entry detail methods
|
||||
|
||||
|
||||
0 passing (23ms)
|
||||
4 failing
|
||||
|
||||
1) test/app/controller/system.storage.delivery.module.test.js
|
||||
should return delivery list via storage.stockout.list:
|
||||
TypeError: fetch failed
|
||||
|
||||
Caused by: Error: connect ECONNREFUSED 127.0.0.1:6060
|
||||
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1645:16)
|
||||
|
||||
2) test/app/controller/system.storage.delivery.module.test.js
|
||||
should return placeholder failure via storage.stockout.toOrder:
|
||||
TypeError: fetch failed
|
||||
|
||||
Caused by: Error: connect ECONNREFUSED 127.0.0.1:6060
|
||||
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1645:16)
|
||||
|
||||
3) test/app/controller/system.storage.delivery.module.test.js
|
||||
should return item list via storage.stockout.listItems:
|
||||
TypeError: fetch failed
|
||||
|
||||
Caused by: Error: connect ECONNREFUSED 127.0.0.1:6060
|
||||
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1645:16)
|
||||
|
||||
4) test/app/controller/system.storage.delivery.module.test.js
|
||||
should not expose removed storage.entry detail methods:
|
||||
TypeError: fetch failed
|
||||
|
||||
Caused by: Error: connect ECONNREFUSED 127.0.0.1:6060
|
||||
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1645:16)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.html
|
||||
|
||||
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.storage.delivery.module.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
|
||||
## 执行错误
|
||||
|
||||
- 错误对象: (无)
|
||||
@ -0,0 +1,85 @@
|
||||
# 测试结果
|
||||
|
||||
- 状态: SKIP
|
||||
- 分类: 主区
|
||||
- 文件: app/controller/system.storage.entry.test.js
|
||||
- 源: main
|
||||
- 测试类型: 自动化文件级执行
|
||||
- 测试账号: liufumingren
|
||||
- 测试仓 ID: 100000
|
||||
- 测试货主 ID: 1000000
|
||||
- 开始时间: 2026-04-10T13:04:47.735Z
|
||||
- 结束时间: 2026-04-10T13:04:49.200Z
|
||||
- 耗时(秒): 1
|
||||
- 退出码: 1
|
||||
- 说明: 环境/数据缺失: ECONNREFUSED
|
||||
|
||||
## 执行输出摘录
|
||||
|
||||
```text
|
||||
[egg-ts-helper] create typings\app\extend\application.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\app\controller\index.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\model\index.d.ts (2ms)
|
||||
[egg-ts-helper] create typings\config\index.d.ts (13ms)
|
||||
[egg-ts-helper] create typings\config\plugin.d.ts (1ms)
|
||||
[egg-ts-helper] create typings\app\service\index.d.ts (3ms)
|
||||
[egg-ts-helper] create typings\app\index.d.ts (0ms)
|
||||
|
||||
|
||||
test/app/controller/system.storage.entry.test.js
|
||||
1) should query entry list
|
||||
2) should create entry and run detail lifecycle then cancel
|
||||
3) should complete entry after adding detail
|
||||
4) should reject invalid params for create/get/addDetail
|
||||
|
||||
|
||||
0 passing (26ms)
|
||||
4 failing
|
||||
|
||||
1) test/app/controller/system.storage.entry.test.js
|
||||
should query entry list:
|
||||
TypeError: fetch failed
|
||||
|
||||
Caused by: Error: connect ECONNREFUSED 127.0.0.1:6060
|
||||
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1645:16)
|
||||
|
||||
2) test/app/controller/system.storage.entry.test.js
|
||||
should create entry and run detail lifecycle then cancel:
|
||||
TypeError: fetch failed
|
||||
|
||||
Caused by: Error: connect ECONNREFUSED 127.0.0.1:6060
|
||||
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1645:16)
|
||||
|
||||
3) test/app/controller/system.storage.entry.test.js
|
||||
should complete entry after adding detail:
|
||||
TypeError: fetch failed
|
||||
|
||||
Caused by: Error: connect ECONNREFUSED 127.0.0.1:6060
|
||||
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1645:16)
|
||||
|
||||
4) test/app/controller/system.storage.entry.test.js
|
||||
should reject invalid params for create/get/addDetail:
|
||||
TypeError: fetch failed
|
||||
|
||||
Caused by: Error: connect ECONNREFUSED 127.0.0.1:6060
|
||||
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1645:16)
|
||||
|
||||
|
||||
|
||||
[mochawesome] Report JSON saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.json
|
||||
|
||||
[mochawesome] Report HTML saved to D:\wms\node_modules\.mochawesome-reports\mochawesome.html
|
||||
|
||||
|
||||
ForkError: D:\wms\node_modules\mocha\bin\_mocha --exit --timeout=60000 --reporter=D:\wms\node_modules\mochawesome-with-mocha\src\mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports --require=D:\wms\node_modules\egg-mock\register.js test/app/controller/system.storage.entry.test.js exit with code 1
|
||||
at ChildProcess.<anonymous> (D:\wms\node_modules\egg-bin\dist\cmd\base.js:98:33)
|
||||
at Object.onceWrapper (node:events:623:26)
|
||||
at ChildProcess.emit (node:events:508:28)
|
||||
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
|
||||
code: 1
|
||||
}
|
||||
```
|
||||
|
||||
## 执行错误
|
||||
|
||||
- 错误对象: (无)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user