You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.2 KiB
33 lines
1.2 KiB
import { describe, expect, it } from "vitest";
|
|
import fs from "fs";
|
|
import path from "path";
|
|
import { parseLabelInstructionBuffer } from "@/services/parse/label-instruction";
|
|
|
|
describe("parseLabelInstructionBuffer", () => {
|
|
it("parses M4 贴标指令操作单", async () => {
|
|
const xlsx = path.join(
|
|
process.cwd(),
|
|
"docx",
|
|
"邮件",
|
|
"邮件4",
|
|
"YT2604021091=76件换标走HIA1卡派出库操作指令.xlsx",
|
|
);
|
|
if (!fs.existsSync(xlsx)) return;
|
|
const buf = fs.readFileSync(xlsx);
|
|
const r = await parseLabelInstructionBuffer(buf, { enableIsoCheck: false });
|
|
expect(r).not.toBeNull();
|
|
expect(r!.errorCode).toBeUndefined();
|
|
expect(r!.container_header.F_ContainerNo).toBe("WHSU6227512");
|
|
expect(r!.shipments.length).toBeGreaterThanOrEqual(1);
|
|
const s0 = r!.shipments[0];
|
|
expect(s0.F_FBACode).toBe("HIA1");
|
|
expect(s0.F_CTNS).toBe(76);
|
|
expect(s0.F_Pcs).toBe(304);
|
|
expect(s0.F_PO).toBe("2G1MCB6X");
|
|
expect(s0.F_ReferenceId).toBe("2G1MCB6X");
|
|
expect(s0.F_FBAID).toBe("FBA19HW52S0L");
|
|
expect(String(s0.F_Remark || "")).toMatch(/覆盖贴/);
|
|
expect(String(s0.F_Remark || "")).not.toMatch(/产品数量:/);
|
|
});
|
|
});
|