来源仓库:jxc/ai-fresh-delivery 来源提交:f0b1a180e2deb7e4673b9d1c8542619f7bc0f73d 快照树: 09f679334ff38f0ff25e907961c94a8223bcaedd(与来源 HEAD 工作树逐字节一致,3801 个文件) 按约定本仓库不带任何历史提交:来源仓库的历史中含真实凭据 (生产 SSH 私钥 deploy/id_rsa_tencent、server/.env、.env.tencent/.env.production/.env.gitea、 deploy/小程序AppSecret.txt,其中 MP_APPSECRET / S3 AccessKey 经哈希比对与线上同值), 整包推送会把这些凭据永久带入本仓库,故只取「当前版本」的单提交快照。 供应商系统后续开发自本提交开始。
52 lines
3.0 KiB
TypeScript
52 lines
3.0 KiB
TypeScript
import { readFileSync } from 'node:fs';
|
|
import path from 'path';
|
|
import { describe, expect, it } from 'vitest';
|
|
|
|
describe('结案跳过本单过手未入台账行', () => {
|
|
const outbound = readFileSync(
|
|
path.join(__dirname, '../src/services/inventoryOutboundService.ts'),
|
|
'utf8'
|
|
);
|
|
const inspect = readFileSync(
|
|
path.join(__dirname, '../src/services/inspectionComplianceService.ts'),
|
|
'utf8'
|
|
);
|
|
const picking = readFileSync(path.join(__dirname, '../src/services/pickingService.ts'), 'utf8');
|
|
|
|
it('判定只认验收流水备注「过手履约跳过库存台账」,不看当前 stock_mode', () => {
|
|
expect(outbound).toContain("export const PASS_THROUGH_LEDGER_SKIP_REMARK = '过手履约跳过库存台账'");
|
|
expect(outbound).toContain('export async function orderSkuSkippedPassThroughLedger');
|
|
expect(outbound).toContain("AND operation_type = 'inspection_in'");
|
|
expect(outbound).toContain("remark ILIKE '%' || $3 || '%'");
|
|
expect(outbound).toContain("OR remark ILIKE '%' || $4 || '%'");
|
|
expect(outbound).toContain("export const WAREHOUSE_FINISHED_LEDGER_SKIP_REMARK = '仓内加工成品不入可领库存'");
|
|
expect(inspect).toContain('过手履约跳过库存台账 ${input.id}');
|
|
const helperStart = outbound.indexOf('export async function orderSkuSkippedPassThroughLedger');
|
|
const helperEnd = outbound.indexOf('function businessError', helperStart);
|
|
expect(helperStart).toBeGreaterThan(-1);
|
|
expect(outbound.slice(helperStart, helperEnd)).not.toContain('isPassThroughSku');
|
|
expect(outbound.slice(helperStart, helperEnd)).not.toContain('stock_mode');
|
|
});
|
|
|
|
it('发车扣库与结案/回冲计划均跳过该备注行', () => {
|
|
expect(outbound).toContain('orderSkuSkippedPassThroughLedger(client, code, row.sku)');
|
|
expect(outbound).toContain('orderSkuSkippedPassThroughLedger(client, orderCode, row.sku)');
|
|
expect(outbound).toContain('orderSkuSkippedPassThroughLedger(client, orderCode, sku)');
|
|
const planStart = outbound.indexOf('async function planDeductLinesForOrder');
|
|
const planSrc = outbound.slice(planStart, planStart + 4500);
|
|
expect(planSrc).toContain('orderSkuSkippedPassThroughLedger');
|
|
expect(outbound).toContain('ensureOrderInventorySettledOnComplete');
|
|
expect(outbound).toContain('planDeductLinesForOrder(client, code, branchCode)');
|
|
});
|
|
|
|
it('不合单复用主单批次、不改 fifo 本体与分拣扣库', () => {
|
|
const helperStart = outbound.indexOf('export async function orderSkuSkippedPassThroughLedger');
|
|
const fifoStart = outbound.indexOf('export async function fifoDeductInventory');
|
|
expect(outbound.slice(helperStart, fifoStart)).not.toContain('合单复用主单批次');
|
|
const fifoBody = outbound.slice(fifoStart, outbound.indexOf('export async function deductInventoryForOrderDeparture'));
|
|
expect(fifoBody).not.toContain('orderSkuSkippedPassThroughLedger');
|
|
expect(picking).toContain('orderSkuSkippedPassThroughLedger');
|
|
expect(picking).toContain('isPassThroughSku');
|
|
});
|
|
});
|