2110 lines
64 KiB
JavaScript
2110 lines
64 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require('node:assert/strict');
|
|
const OrderPrintSystemService = require('../../../../app/service/systems/order_print');
|
|
|
|
function createOrderPrintServiceHarness() {
|
|
const ctx = {
|
|
app: {
|
|
baseDir: 'd:/wms',
|
|
},
|
|
user: {
|
|
store_id: 100000,
|
|
},
|
|
logger: {
|
|
info() {},
|
|
warn() {},
|
|
error() {},
|
|
},
|
|
model: {
|
|
Express: {
|
|
async findAll() {
|
|
return [];
|
|
},
|
|
},
|
|
QueryTypes: {
|
|
SELECT: 'SELECT',
|
|
},
|
|
},
|
|
service: {
|
|
systems: {
|
|
express: {
|
|
pickWaybillExpressInterface() {
|
|
return null;
|
|
},
|
|
},
|
|
setting: {
|
|
expressInterface: {
|
|
async listByWarehousePlatformCode() {
|
|
return {
|
|
code: 200,
|
|
data: [],
|
|
};
|
|
},
|
|
},
|
|
},
|
|
storeWarehouse: {
|
|
async getContractConfig() {
|
|
return {
|
|
policy_config: {},
|
|
};
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
|
|
return new OrderPrintSystemService(ctx);
|
|
}
|
|
|
|
describe('test/app/service/systems/order_print.getWavePlatformPrintData.test.js', () => {
|
|
it('should map kuaishou encryptedData/signature/key from order_express fields', () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
|
|
const result = service.buildOrderPlatformPrintItem({
|
|
orderRow: {
|
|
id: 101,
|
|
wave_id: 10,
|
|
wave_no: 'W010',
|
|
delivery_order_code: 'DO101',
|
|
store_id: 1,
|
|
warehouse_id: 100000,
|
|
items: JSON.stringify([
|
|
{
|
|
item_name: '化妆品',
|
|
pick_location: 'E2区02-04-02',
|
|
barcode: '6973348850399',
|
|
quantity: 2,
|
|
},
|
|
]),
|
|
},
|
|
orderExpress: {
|
|
waybill_code: 'WB101',
|
|
printinfo: 'ENC_FROM_DB',
|
|
signature: 'SIG_FROM_DB',
|
|
encryptprintinfo: 'KEY_FROM_DB',
|
|
logistics_name: '顺丰',
|
|
logistics_interface_name: '申通快递',
|
|
},
|
|
policyConfig: {
|
|
province_name: '浙江省',
|
|
city_name: '杭州市',
|
|
district_name: '滨江区',
|
|
address: '网商路 699 号',
|
|
sender_name: '张三',
|
|
sender_tel: '13800000000',
|
|
waybill_custom_display_type: '5',
|
|
},
|
|
platformCode: 'kuaishou',
|
|
templateSample: {
|
|
cmd: 'print',
|
|
requestID: 'sample-request',
|
|
version: '1.0',
|
|
taskID: 'sample-task',
|
|
task: {
|
|
documents: [
|
|
{
|
|
documentID: 'sample-doc',
|
|
contents: [
|
|
{
|
|
encryptedData: 'SAMPLE_ENCRYPTED_DATA',
|
|
signature: 'SAMPLE_SIGNATURE',
|
|
key: 'SAMPLE_KEY',
|
|
templateURL: 'https://example.com/kuaishou.xml',
|
|
data: {
|
|
productInfo: '#0 sample product info',
|
|
},
|
|
},
|
|
{
|
|
templateURL: 'http://www.ye4s.com/mb/kuaishou.xml',
|
|
customData: {
|
|
productInfo: '#1 sample custom product info',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
});
|
|
|
|
assert.equal(result.print_data.documentID, 'WB101');
|
|
assert.equal(result.print_data.waybillCode, 'WB101');
|
|
assert.ok(Array.isArray(result.print_data.contents));
|
|
|
|
const mappedContent = result.print_data.contents[0];
|
|
assert.equal(mappedContent.encryptedData, 'ENC_FROM_DB');
|
|
assert.equal(mappedContent.signature, 'SIG_FROM_DB');
|
|
assert.equal(mappedContent.key, 'KEY_FROM_DB');
|
|
assert.equal(mappedContent.templateURL, 'https://example.com/kuaishou.xml');
|
|
assert.equal(mappedContent.data.productInfo, '__SAMPLE__');
|
|
assert.equal(mappedContent.addData.senderInfo.address.countryCode, 'CHN');
|
|
assert.equal(mappedContent.addData.senderInfo.address.detailAddress, '网商路 699 号');
|
|
assert.equal(mappedContent.addData.senderInfo.contact.name, '张三');
|
|
assert.equal(mappedContent.addData.senderInfo.contact.mobile, '13800000000');
|
|
|
|
const customDataContent = result.print_data.contents.find(content => content && content.customData);
|
|
assert.ok(customDataContent);
|
|
assert.equal(customDataContent.templateURL, 'http://www.ye4s.com/mb/kuaishou.xml');
|
|
assert.ok(customDataContent.customData.productInfo.includes('W010 申通快递'));
|
|
assert.ok(customDataContent.customData.productInfo.includes('E2区02-04-02 化妆品 6973348850399 【2】'));
|
|
});
|
|
|
|
it('should map pdd encryptedData/signature and sender fields from order_express and policy_config', () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
|
|
const result = service.buildOrderPlatformPrintItem({
|
|
orderRow: {
|
|
id: 201,
|
|
wave_id: 20,
|
|
wave_no: 'W020',
|
|
delivery_order_code: 'DO201',
|
|
store_id: 1,
|
|
warehouse_id: 100000,
|
|
items: JSON.stringify([
|
|
{
|
|
pick_location: 'A1-01-01',
|
|
barcode: '1234567890123',
|
|
quantity: 1,
|
|
},
|
|
]),
|
|
},
|
|
orderExpress: {
|
|
waybill_code: ' WB201 ',
|
|
printinfo: ' ENC_FROM_DB_PDD ',
|
|
encryptprintinfo: ' ENC_FROM_DB_PDD ',
|
|
signature: ' SIG_FROM_DB_PDD ',
|
|
ver: ' 12 ',
|
|
logistics_name: '中通',
|
|
logistics_interface_name: '顺丰空运',
|
|
},
|
|
policyConfig: {
|
|
province_name: '广东省',
|
|
city_name: '深圳市',
|
|
district_name: '南山区',
|
|
address: '科技园南区 1 号',
|
|
sender_name: '李四',
|
|
sender_tel: '13900000000',
|
|
waybill_custom_display_type: '4',
|
|
},
|
|
platformCode: 'pdd',
|
|
templateSample: {
|
|
cmd: 'print',
|
|
requestID: 'sample-request',
|
|
version: '1.0',
|
|
taskID: 'sample-task',
|
|
task: {
|
|
documents: [
|
|
{
|
|
documentID: 'sample-doc',
|
|
contents: [
|
|
{
|
|
addData: {
|
|
sender: {
|
|
address: {
|
|
province: '',
|
|
city: '',
|
|
district: '',
|
|
detail: '',
|
|
},
|
|
mobile: '',
|
|
name: '',
|
|
},
|
|
},
|
|
encryptedData: 'SAMPLE_ENCRYPTED_DATA',
|
|
signature: 'SAMPLE_SIGNATURE',
|
|
templateURL: 'https://example.com/pdd.xml',
|
|
data: {
|
|
productInfo: '#0 sample product info',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
});
|
|
|
|
assert.equal(result.print_data.documentID, 'WB201');
|
|
assert.equal(result.print_data.contents[0].encryptedData, 'ENC_FROM_DB_PDD');
|
|
assert.equal(result.print_data.contents[0].signature, 'SIG_FROM_DB_PDD');
|
|
assert.equal(result.print_data.contents[0].ver, '12');
|
|
assert.equal(result.print_data.contents[0].addData.sender.address.province, '广东省');
|
|
assert.equal(result.print_data.contents[0].addData.sender.address.city, '深圳市');
|
|
assert.equal(result.print_data.contents[0].addData.sender.address.district, '南山区');
|
|
assert.equal(result.print_data.contents[0].addData.sender.address.detail, '科技园南区 1 号');
|
|
assert.equal(result.print_data.contents[0].addData.sender.mobile, '13900000000');
|
|
assert.equal(result.print_data.contents[0].addData.sender.name, '李四');
|
|
|
|
const customContent = result.print_data.contents.find(content => {
|
|
return content && content.data && Array.isArray(content.data.list);
|
|
});
|
|
assert.ok(customContent);
|
|
assert.equal(customContent.templateURL, 'http://www.ye4s.com/mb/pdd.xml');
|
|
assert.ok(customContent.data.list[0].text.includes('\r'));
|
|
assert.ok(customContent.data.list[0].text.includes('W020 顺丰空运'));
|
|
assert.ok(customContent.data.list[0].text.includes('A1-01-01 90123 【1】'));
|
|
});
|
|
|
|
it('should build custom text when order items is wrapped object string', () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
|
|
const result = service.buildOrderPlatformPrintItem({
|
|
orderRow: {
|
|
id: 202,
|
|
wave_id: 21,
|
|
wave_no: 'W021',
|
|
delivery_order_code: 'DO202',
|
|
store_id: 1,
|
|
warehouse_id: 100000,
|
|
items: JSON.stringify({
|
|
items: [
|
|
{
|
|
pick_location: 'C1-01-01',
|
|
barcode: '9988776655443',
|
|
quantity: 3,
|
|
},
|
|
],
|
|
}),
|
|
},
|
|
orderExpress: {
|
|
waybill_code: 'WB202',
|
|
printinfo: 'ENC_202',
|
|
signature: 'SIG_202',
|
|
logistics_name: '圆通',
|
|
},
|
|
policyConfig: {
|
|
waybill_custom_display_type: '3',
|
|
sender_name: '张三',
|
|
sender_tel: '13800000000',
|
|
province_name: '浙江省',
|
|
city_name: '杭州市',
|
|
district_name: '西湖区',
|
|
address: '文三路 1 号',
|
|
},
|
|
platformCode: 'pdd',
|
|
templateSample: {
|
|
cmd: 'print',
|
|
requestID: 'REQ-202',
|
|
version: '11',
|
|
task: {
|
|
documents: [
|
|
{
|
|
contents: [
|
|
{
|
|
addData: {
|
|
sender: {
|
|
address: {
|
|
city: '',
|
|
detail: '',
|
|
district: '',
|
|
province: '',
|
|
},
|
|
mobile: '',
|
|
name: '',
|
|
},
|
|
},
|
|
encryptedData: '',
|
|
signature: '',
|
|
templateUrl: 'https://file-link.pinduoduo.com/sto_one',
|
|
userid: '',
|
|
ver: '11',
|
|
},
|
|
{
|
|
data: {
|
|
height: 240,
|
|
list: [
|
|
{
|
|
fontSize: 28,
|
|
left: 2.08,
|
|
text: '',
|
|
top: 2.08,
|
|
width: 550,
|
|
},
|
|
],
|
|
waterdata: {
|
|
text: '',
|
|
},
|
|
width: 560,
|
|
},
|
|
templateURL: 'http://www.ye4s.com/mb/pdd.xml',
|
|
},
|
|
],
|
|
documentID: 'DOC-202',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
});
|
|
|
|
const customContent = result.print_data.contents.find(content => content && content.data && Array.isArray(content.data.list));
|
|
assert.ok(customContent);
|
|
assert.ok(customContent.data.list[0].text.includes('W021 圆通'));
|
|
assert.ok(customContent.data.list[0].text.includes('C1-01-01 9988776655443 【3】'));
|
|
});
|
|
|
|
it('should use cainiao pure main content from printinfo directly and keep custom control content', () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
|
|
const result = service.buildOrderPlatformPrintItem({
|
|
orderRow: {
|
|
id: 207,
|
|
wave_id: 26,
|
|
wave_no: 'W026',
|
|
delivery_order_code: 'DO207',
|
|
store_id: 1,
|
|
warehouse_id: 100000,
|
|
items: JSON.stringify([
|
|
{
|
|
item_name: '运动短袖',
|
|
pick_location: 'E1区01-19-01',
|
|
barcode: '988948487',
|
|
quantity: 2,
|
|
},
|
|
]),
|
|
},
|
|
orderExpress: {
|
|
waybill_code: 'WB207',
|
|
printinfo: JSON.stringify({
|
|
encryptedData: 'ENC-001',
|
|
signature: 'SIG-001',
|
|
templateURL: 'https://upstream.example.com/cainiao/main-template.xml',
|
|
ver: '1.0',
|
|
}),
|
|
cainiao_cp_code: 'STO_CAINIAO',
|
|
cainiao_template_url: 'https://example.com/cainiao/main-template.xml',
|
|
logistics_name: '申通快递',
|
|
},
|
|
policyConfig: {
|
|
waybill_custom_display_type: '5',
|
|
},
|
|
platformCode: 'cainiao',
|
|
templateSample: {
|
|
cmd: 'print',
|
|
requestID: 'REQ-207',
|
|
version: '1.0',
|
|
task: {
|
|
documents: [
|
|
{
|
|
documentID: 'DOC-207',
|
|
contents: [
|
|
{
|
|
templateURL: 'http://cloudprint.cainiao.com/cloudprint/template/getStandardTemplate.json?template_id=288948',
|
|
data: {
|
|
cpCode: '__SAMPLE__',
|
|
recipient: '__SAMPLE__',
|
|
waybillCode: '__SAMPLE__',
|
|
},
|
|
},
|
|
{
|
|
templateURL: 'http://cloudprint.cainiao.com/cloudprint/customArea/queryCustomAreaList4Top.json?custom_area_id=6474956',
|
|
data: {
|
|
CustomControl: '__SAMPLE__',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
});
|
|
|
|
assert.equal(result.print_data.documentID, 'WB207');
|
|
assert.ok(Array.isArray(result.print_data.contents));
|
|
assert.equal(result.print_data.contents.length, 2);
|
|
|
|
const mainContent = result.print_data.contents[0];
|
|
assert.ok(mainContent);
|
|
assert.equal(mainContent.templateURL, 'https://example.com/cainiao/main-template.xml');
|
|
assert.equal(mainContent.encryptedData, 'ENC-001');
|
|
assert.equal(mainContent.signature, 'SIG-001');
|
|
assert.equal(mainContent.ver, '1.0');
|
|
assert.equal(mainContent.data, undefined);
|
|
|
|
const customContent = result.print_data.contents[1];
|
|
assert.ok(customContent);
|
|
assert.equal(customContent.templateURL, 'http://cloudprint.cainiao.com/cloudprint/customArea/queryCustomAreaList4Top.json?custom_area_id=6474956');
|
|
assert.ok(customContent.data.CustomControl.includes('W026 申通快递'));
|
|
assert.ok(customContent.data.CustomControl.includes('E1区01-19-01 运动短袖 988948487 【2】'));
|
|
});
|
|
|
|
it('should unwrap cainiao main content from wrapped contents printinfo without falling back order fields', () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
|
|
const result = service.buildOrderPlatformPrintItem({
|
|
orderRow: {
|
|
id: 209,
|
|
wave_id: 27,
|
|
wave_no: 'W027',
|
|
delivery_order_code: 'DO209',
|
|
store_id: 1,
|
|
warehouse_id: 100000,
|
|
name: '订单收件人',
|
|
mobile: '13999990000',
|
|
province: '浙江省',
|
|
city: '杭州市',
|
|
area: '西湖区',
|
|
detail_address: '订单回填地址 1 号',
|
|
items: JSON.stringify([
|
|
{
|
|
item_name: 'fallback 运动短袖',
|
|
pick_location: 'A1-01-01',
|
|
barcode: '111111111',
|
|
quantity: 1,
|
|
},
|
|
]),
|
|
},
|
|
orderExpress: {
|
|
waybill_code: 'WB209',
|
|
printinfo: JSON.stringify({
|
|
contents: [
|
|
{
|
|
templateURL: 'https://upstream.example.com/cainiao/main-content.xml',
|
|
signature: 'SIG-CONTENT-209',
|
|
data: {
|
|
cpCode: 'STO_UPSTREAM',
|
|
recipient: {
|
|
name: '接口收件人',
|
|
mobile: '13888880000',
|
|
},
|
|
sender: {
|
|
name: '接口发件人',
|
|
},
|
|
packageInfo: {
|
|
goodsDescription: '接口商品描述',
|
|
items: [
|
|
{
|
|
count: 9,
|
|
name: '接口商品',
|
|
},
|
|
],
|
|
},
|
|
routingInfo: {
|
|
routeCode: 'CN-HZ-001',
|
|
},
|
|
waybillCode: 'WB209',
|
|
},
|
|
},
|
|
],
|
|
}),
|
|
cainiao_cp_code: 'STO_CAINIAO',
|
|
cainiao_template_url: 'https://example.com/cainiao/wrapped-template.xml',
|
|
logistics_name: '申通快递',
|
|
},
|
|
policyConfig: {
|
|
sender_name: '策略发件人',
|
|
sender_tel: '13777770000',
|
|
province_name: '上海市',
|
|
city_name: '上海市',
|
|
district_name: '闵行区',
|
|
address: '策略发件地址 2 号',
|
|
waybill_custom_display_type: '5',
|
|
},
|
|
platformCode: 'cainiao',
|
|
templateSample: {
|
|
cmd: 'print',
|
|
requestID: 'REQ-209',
|
|
version: '1.0',
|
|
task: {
|
|
documents: [
|
|
{
|
|
documentID: 'DOC-209',
|
|
contents: [
|
|
{
|
|
templateURL: 'http://cloudprint.cainiao.com/cloudprint/template/getStandardTemplate.json?template_id=288948',
|
|
data: {
|
|
cpCode: '__SAMPLE__',
|
|
recipient: {
|
|
name: '__SAMPLE__',
|
|
},
|
|
sender: {
|
|
name: '__SAMPLE__',
|
|
},
|
|
packageInfo: {
|
|
goodsDescription: '__SAMPLE__',
|
|
},
|
|
routingInfo: {
|
|
routeCode: '__SAMPLE__',
|
|
},
|
|
waybillCode: '__SAMPLE__',
|
|
},
|
|
},
|
|
{
|
|
templateURL: 'http://cloudprint.cainiao.com/cloudprint/customArea/queryCustomAreaList4Top.json?custom_area_id=6474956',
|
|
data: {
|
|
CustomControl: '__SAMPLE__',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
});
|
|
|
|
const mainContent = result.print_data.contents[0];
|
|
assert.equal(mainContent.templateURL, 'https://example.com/cainiao/wrapped-template.xml');
|
|
assert.equal(mainContent.signature, 'SIG-CONTENT-209');
|
|
assert.equal(mainContent.data._dataFrom, 'printinfo');
|
|
assert.equal(mainContent.data.cpCode, 'STO_CAINIAO');
|
|
assert.equal(mainContent.data.realCpCode, 'STO_CAINIAO');
|
|
assert.equal(mainContent.data.recipient.name, '接口收件人');
|
|
assert.equal(mainContent.data.recipient.mobile, '13888880000');
|
|
assert.equal(mainContent.data.sender.name, '接口发件人');
|
|
assert.equal(mainContent.data.packageInfo.goodsDescription, '接口商品描述');
|
|
assert.deepEqual(mainContent.data.packageInfo.items, [
|
|
{
|
|
count: 9,
|
|
name: '接口商品',
|
|
},
|
|
]);
|
|
assert.equal(mainContent.data.routingInfo.routeCode, 'CN-HZ-001');
|
|
assert.notEqual(mainContent.data.recipient.name, '订单收件人');
|
|
assert.notEqual(mainContent.data.sender.name, '策略发件人');
|
|
|
|
const customContent = result.print_data.contents[1];
|
|
assert.ok(customContent);
|
|
assert.ok(customContent.data.CustomControl.includes('W027 申通快递'));
|
|
assert.ok(customContent.data.CustomControl.includes('A1-01-01 fallback 运动短袖 111111111 【1】'));
|
|
});
|
|
|
|
it('should fallback cainiao main content to template skeleton when printinfo is invalid', () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
|
|
const result = service.buildOrderPlatformPrintItem({
|
|
orderRow: {
|
|
id: 208,
|
|
wave_id: 26,
|
|
wave_no: 'W026',
|
|
delivery_order_code: 'DO208',
|
|
store_id: 1,
|
|
warehouse_id: 100000,
|
|
logistics_code: 'YTO',
|
|
sys_logistics_code: 'YTO_SYS',
|
|
name: '李四',
|
|
mobile: '13911112222',
|
|
tel: '020-12345678',
|
|
province: '广东省',
|
|
city: '广州市',
|
|
area: '白云区',
|
|
detail_address: '鹤龙一路 88 号',
|
|
items: JSON.stringify([
|
|
{
|
|
item_name: '运动短袖',
|
|
quantity: 2,
|
|
},
|
|
{
|
|
item_name: '纯棉长裤',
|
|
quantity: 1,
|
|
},
|
|
]),
|
|
},
|
|
orderExpress: {
|
|
waybill_code: 'WB208',
|
|
printinfo: '{invalid-json',
|
|
cainiao_cp_code: 'YTO_CAINIAO',
|
|
cainiao_template_url: 'https://example.com/cainiao/fallback-template.xml',
|
|
logistics_code: '',
|
|
logistics_name: '圆通速递',
|
|
},
|
|
policyConfig: {
|
|
sender_name: '仓库发货人',
|
|
sender_tel: '13812345678',
|
|
province_name: '浙江省',
|
|
city_name: '杭州市',
|
|
district_name: '余杭区',
|
|
address: '良睦路 999 号',
|
|
},
|
|
platformCode: 'cainiao',
|
|
templateSample: {
|
|
cmd: 'print',
|
|
requestID: 'REQ-208',
|
|
version: '1.0',
|
|
task: {
|
|
documents: [
|
|
{
|
|
documentID: 'DOC-208',
|
|
contents: [
|
|
{
|
|
templateURL: 'http://cloudprint.cainiao.com/cloudprint/template/getStandardTemplate.json?template_id=288948',
|
|
data: {
|
|
cpCode: '__SAMPLE__',
|
|
realCpCode: '__SAMPLE__',
|
|
recipient: {
|
|
name: '__SAMPLE__',
|
|
mobile: '__SAMPLE__',
|
|
tel: '__SAMPLE__',
|
|
address: {
|
|
province: '__SAMPLE__',
|
|
city: '__SAMPLE__',
|
|
district: '__SAMPLE__',
|
|
detail: '__SAMPLE__',
|
|
},
|
|
},
|
|
sender: {
|
|
name: '__SAMPLE__',
|
|
mobile: '__SAMPLE__',
|
|
address: {
|
|
province: '__SAMPLE__',
|
|
city: '__SAMPLE__',
|
|
district: '__SAMPLE__',
|
|
detail: '__SAMPLE__',
|
|
},
|
|
},
|
|
packageInfo: {
|
|
goodsDescription: '__SAMPLE__',
|
|
items: [
|
|
{
|
|
count: '__SAMPLE__',
|
|
name: '__SAMPLE__',
|
|
},
|
|
],
|
|
},
|
|
waybillCode: '__SAMPLE__',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
});
|
|
|
|
const mainData = result.print_data.contents[0].data;
|
|
assert.equal(result.print_data.contents[0].templateURL, 'https://example.com/cainiao/fallback-template.xml');
|
|
assert.equal(mainData.waybillCode, '');
|
|
assert.equal(mainData._dataFrom, 'template');
|
|
assert.equal(mainData.cpCode, 'YTO_CAINIAO');
|
|
assert.equal(mainData.realCpCode, 'YTO_CAINIAO');
|
|
assert.equal(mainData.recipient.name, '');
|
|
assert.equal(mainData.recipient.mobile, '');
|
|
assert.equal(mainData.recipient.tel, '');
|
|
assert.equal(mainData.recipient.address.province, '');
|
|
assert.equal(mainData.recipient.address.city, '');
|
|
assert.equal(mainData.recipient.address.district, '');
|
|
assert.equal(mainData.recipient.address.detail, '');
|
|
assert.equal(mainData.sender.name, '');
|
|
assert.equal(mainData.sender.mobile, '');
|
|
assert.equal(mainData.sender.address.province, '');
|
|
assert.equal(mainData.sender.address.city, '');
|
|
assert.equal(mainData.sender.address.district, '');
|
|
assert.equal(mainData.sender.address.detail, '');
|
|
assert.equal(mainData.packageInfo.goodsDescription, '');
|
|
assert.deepEqual(mainData.packageInfo.items, [
|
|
{
|
|
count: '',
|
|
name: '',
|
|
},
|
|
]);
|
|
assert.equal(mainData.routingInfo, undefined);
|
|
});
|
|
|
|
it('should parse string policy_config in getPolicyConfigMapByStore', async () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
service.ctx.service.systems.storeWarehouse.getContractConfig = async () => ({
|
|
policy_config: JSON.stringify({
|
|
waybill_custom_display_type: '3',
|
|
sender_name: '赵六',
|
|
}),
|
|
});
|
|
|
|
const policyMap = await service.getPolicyConfigMapByStore([
|
|
{ store_id: 9 },
|
|
], 100000);
|
|
|
|
const storePolicy = policyMap.get(9) || {};
|
|
assert.equal(storePolicy.waybill_custom_display_type, '3');
|
|
assert.equal(storePolicy.sender_name, '赵六');
|
|
});
|
|
|
|
it('should default to literal compose when waybill display type is missing', () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
|
|
const result = service.buildOrderPlatformPrintItem({
|
|
orderRow: {
|
|
id: 203,
|
|
wave_id: 22,
|
|
wave_no: 'W022',
|
|
delivery_order_code: 'DO203',
|
|
store_id: 1,
|
|
warehouse_id: 100000,
|
|
items: JSON.stringify([
|
|
{
|
|
item_name: '皮带黑色',
|
|
pick_location: 'E2区08-05-02',
|
|
barcode: '665835404213',
|
|
quantity: 1,
|
|
},
|
|
]),
|
|
},
|
|
orderExpress: {
|
|
waybill_code: 'WB203',
|
|
printinfo: 'ENC_203',
|
|
signature: 'SIG_203',
|
|
logistics_name: '韵达',
|
|
},
|
|
policyConfig: {
|
|
province_name: '广东省',
|
|
city_name: '广州市',
|
|
district_name: '白云区',
|
|
address: '良沙二路32号',
|
|
sender_name: '刘付明仁',
|
|
sender_tel: '18022440198',
|
|
},
|
|
platformCode: 'pdd',
|
|
templateSample: {
|
|
cmd: 'print',
|
|
requestID: 'REQ-203',
|
|
version: '11',
|
|
task: {
|
|
documents: [
|
|
{
|
|
contents: [
|
|
{
|
|
addData: {
|
|
sender: {
|
|
address: {
|
|
city: '',
|
|
detail: '',
|
|
district: '',
|
|
province: '',
|
|
},
|
|
mobile: '',
|
|
name: '',
|
|
},
|
|
},
|
|
encryptedData: '',
|
|
signature: '',
|
|
templateUrl: 'https://file-link.pinduoduo.com/sto_one',
|
|
userid: '',
|
|
ver: '11',
|
|
},
|
|
{
|
|
data: {
|
|
height: 240,
|
|
list: [
|
|
{
|
|
fontSize: 28,
|
|
left: 2.08,
|
|
text: '',
|
|
top: 2.08,
|
|
width: 550,
|
|
},
|
|
],
|
|
waterdata: {
|
|
text: '',
|
|
},
|
|
width: 560,
|
|
},
|
|
templateURL: 'http://www.ye4s.com/mb/pdd.xml',
|
|
},
|
|
],
|
|
documentID: 'DOC-203',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
});
|
|
|
|
const customContent = result.print_data.contents.find(content => content && content.data && Array.isArray(content.data.list));
|
|
assert.ok(customContent);
|
|
assert.ok(customContent.data.list[0].text.includes('W022 韵达'));
|
|
assert.ok(customContent.data.list[0].text.includes('E2区08-05-02 皮带黑色 665835404213 【1】'));
|
|
});
|
|
|
|
it('should keep header line when item details are unavailable', () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
|
|
const result = service.buildOrderPlatformPrintItem({
|
|
orderRow: {
|
|
id: 204,
|
|
wave_id: 23,
|
|
wave_no: 'W023',
|
|
delivery_order_code: 'DO204',
|
|
store_id: 1,
|
|
warehouse_id: 100000,
|
|
items: '',
|
|
items_count: 2,
|
|
},
|
|
orderExpress: {
|
|
waybill_code: 'WB204',
|
|
printinfo: 'ENC_204',
|
|
signature: 'SIG_204',
|
|
logistics_name: '中通',
|
|
},
|
|
policyConfig: {
|
|
waybill_custom_display_type: '5',
|
|
province_name: '广东省',
|
|
city_name: '广州市',
|
|
district_name: '白云区',
|
|
address: '良沙二路32号',
|
|
sender_name: '刘付明仁',
|
|
sender_tel: '18022440198',
|
|
},
|
|
platformCode: 'pdd',
|
|
templateSample: {
|
|
cmd: 'print',
|
|
requestID: 'REQ-204',
|
|
version: '11',
|
|
task: {
|
|
documents: [
|
|
{
|
|
contents: [
|
|
{
|
|
addData: {
|
|
sender: {
|
|
address: {
|
|
city: '',
|
|
detail: '',
|
|
district: '',
|
|
province: '',
|
|
},
|
|
mobile: '',
|
|
name: '',
|
|
},
|
|
},
|
|
encryptedData: '',
|
|
signature: '',
|
|
templateUrl: 'https://file-link.pinduoduo.com/sto_one',
|
|
userid: '',
|
|
ver: '11',
|
|
},
|
|
{
|
|
data: {
|
|
height: 240,
|
|
list: [
|
|
{
|
|
fontSize: 28,
|
|
left: 2.08,
|
|
text: '',
|
|
top: 2.08,
|
|
width: 550,
|
|
},
|
|
],
|
|
waterdata: {
|
|
text: '',
|
|
},
|
|
width: 560,
|
|
},
|
|
templateURL: 'http://www.ye4s.com/mb/pdd.xml',
|
|
},
|
|
],
|
|
documentID: 'DOC-204',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
});
|
|
|
|
const customContent = result.print_data.contents.find(content => content && content.data && Array.isArray(content.data.list));
|
|
assert.ok(customContent);
|
|
assert.equal(customContent.data.list[0].text, 'W023 中通\r');
|
|
});
|
|
|
|
it('should render detail lines from non-json string items', () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
|
|
const result = service.buildOrderPlatformPrintItem({
|
|
orderRow: {
|
|
id: 205,
|
|
wave_id: 24,
|
|
wave_no: 'W024',
|
|
delivery_order_code: 'DO205',
|
|
store_id: 1,
|
|
warehouse_id: 100000,
|
|
items: '皮带黑色*1|皮带金色*2',
|
|
items_count: 2,
|
|
},
|
|
orderExpress: {
|
|
waybill_code: 'WB205',
|
|
printinfo: 'ENC_205',
|
|
signature: 'SIG_205',
|
|
logistics_name: '申通快递',
|
|
},
|
|
policyConfig: {
|
|
waybill_custom_display_type: '2',
|
|
province_name: '广东省',
|
|
city_name: '广州市',
|
|
district_name: '白云区',
|
|
address: '良沙二路32号',
|
|
sender_name: '刘付明仁',
|
|
sender_tel: '18022440198',
|
|
},
|
|
platformCode: 'kuaishou',
|
|
templateSample: {
|
|
cmd: 'print',
|
|
requestID: 'REQ-205',
|
|
version: '1.0',
|
|
task: {
|
|
documents: [
|
|
{
|
|
contents: [
|
|
{
|
|
encryptedData: '',
|
|
signature: '',
|
|
key: '',
|
|
templateURL: 'https://example.com/kuaishou.xml',
|
|
},
|
|
{
|
|
templateURL: 'http://www.ye4s.com/mb/kuaishou.xml',
|
|
customData: {
|
|
productInfo: '',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
});
|
|
|
|
const customDataContent = result.print_data.contents.find(content => content && content.customData);
|
|
assert.ok(customDataContent);
|
|
assert.ok(customDataContent.customData.productInfo.includes('W024 申通快递'));
|
|
assert.ok(customDataContent.customData.productInfo.includes('皮带黑色 【1】'));
|
|
assert.ok(customDataContent.customData.productInfo.includes('皮带金色 【2】'));
|
|
});
|
|
|
|
it('should render display type 4 as pick location + last 5 barcode + qty per line', () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
|
|
const result = service.buildOrderPlatformPrintItem({
|
|
orderRow: {
|
|
id: 206,
|
|
wave_id: 25,
|
|
wave_no: 'W025',
|
|
delivery_order_code: 'DO206',
|
|
store_id: 1,
|
|
warehouse_id: 100000,
|
|
items: 'E2区08-05-02 皮带黑色;665835404213 【1】 0|E2区08-04-02 皮带金色;600507 【1】 0',
|
|
items_count: 2,
|
|
},
|
|
orderExpress: {
|
|
waybill_code: 'WB206',
|
|
printinfo: 'ENC_206',
|
|
signature: 'SIG_206',
|
|
logistics_name: '顺丰空运',
|
|
},
|
|
policyConfig: {
|
|
waybill_custom_display_type: '4',
|
|
province_name: '广东省',
|
|
city_name: '广州市',
|
|
district_name: '白云区',
|
|
address: '良沙二路32号',
|
|
sender_name: '刘付明仁',
|
|
sender_tel: '18022440198',
|
|
},
|
|
platformCode: 'pdd',
|
|
templateSample: {
|
|
cmd: 'print',
|
|
requestID: 'REQ-206',
|
|
version: '11',
|
|
task: {
|
|
documents: [
|
|
{
|
|
contents: [
|
|
{
|
|
addData: {
|
|
sender: {
|
|
address: {
|
|
city: '',
|
|
detail: '',
|
|
district: '',
|
|
province: '',
|
|
},
|
|
mobile: '',
|
|
name: '',
|
|
},
|
|
},
|
|
encryptedData: '',
|
|
signature: '',
|
|
templateUrl: 'https://file-link.pinduoduo.com/sto_one',
|
|
userid: '',
|
|
ver: '11',
|
|
},
|
|
{
|
|
data: {
|
|
height: 240,
|
|
list: [
|
|
{
|
|
fontSize: 28,
|
|
left: 2.08,
|
|
text: '',
|
|
top: 2.08,
|
|
width: 550,
|
|
},
|
|
],
|
|
waterdata: {
|
|
text: '',
|
|
},
|
|
width: 560,
|
|
},
|
|
templateURL: 'http://www.ye4s.com/mb/pdd.xml',
|
|
},
|
|
],
|
|
documentID: 'DOC-206',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
});
|
|
|
|
const customContent = result.print_data.contents.find(content => content && content.data && Array.isArray(content.data.list));
|
|
assert.ok(customContent);
|
|
const text = customContent.data.list[0].text;
|
|
assert.ok(text.includes('W025 顺丰空运'));
|
|
assert.ok(text.includes('E2区08-05-02 04213 【1】'));
|
|
assert.ok(text.includes('E2区08-04-02 00507 【1】'));
|
|
assert.ok(!text.includes('\r【1】\r'));
|
|
});
|
|
|
|
it('should query order_express with kuaishou encrypted payload columns', async () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
let capturedAttributes = [];
|
|
let capturedWhere = {};
|
|
service.ctx.model.OrderExpress = {
|
|
async findAll(options) {
|
|
capturedAttributes = Array.isArray(options && options.attributes) ? options.attributes : [];
|
|
capturedWhere = options && options.where || {};
|
|
return [];
|
|
},
|
|
};
|
|
|
|
await service.queryOrderExpressByOrderIds([ 101 ]);
|
|
|
|
assert.ok(capturedAttributes.includes('printinfo'));
|
|
assert.ok(capturedAttributes.includes('signature'));
|
|
assert.ok(capturedAttributes.includes('encryptprintinfo'));
|
|
assert.ok(capturedAttributes.includes('ver'));
|
|
assert.ok(capturedAttributes.includes('logistics_interface_name'));
|
|
assert.equal(capturedWhere.business_key, 1);
|
|
});
|
|
|
|
it('should keep original platform value in resolvePrintPlatformCode without alias mapping', () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
|
|
const platformCode = service.resolvePrintPlatformCode(
|
|
{
|
|
sys_platform_code: ' Taobao ',
|
|
source_platform_code: ' tb ',
|
|
},
|
|
{
|
|
platform_code: ' cainiao ',
|
|
}
|
|
);
|
|
|
|
assert.equal(platformCode, 'Taobao');
|
|
});
|
|
|
|
it('should keep original platform field in buildOrderPlatformPrintItem result', () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
|
|
const result = service.buildOrderPlatformPrintItem({
|
|
orderRow: {
|
|
id: 301,
|
|
wave_id: 31,
|
|
wave_no: 'W031',
|
|
delivery_order_code: 'DO301',
|
|
store_id: 1,
|
|
warehouse_id: 100000,
|
|
},
|
|
orderExpress: {
|
|
waybill_code: 'WB301',
|
|
},
|
|
policyConfig: {},
|
|
platformCode: ' Taobao ',
|
|
templateSample: {},
|
|
});
|
|
|
|
assert.equal(result.platform, 'Taobao');
|
|
});
|
|
|
|
it('should throw when business_key=1 waybill data is missing', async () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
|
|
service.queryWavesByIds = async () => ([
|
|
{ wave_id: 1, wave_no: 'W001' },
|
|
]);
|
|
service.queryOrdersByWaveIds = async () => ([
|
|
{
|
|
id: 101,
|
|
wave_id: 1,
|
|
wave_no: 'W001',
|
|
warehouse_id: 100000,
|
|
store_id: 1,
|
|
delivery_order_code: 'O101',
|
|
post_status: 'fin',
|
|
sys_platform_code: 'kuaishou',
|
|
},
|
|
{
|
|
id: 102,
|
|
wave_id: 1,
|
|
wave_no: 'W001',
|
|
warehouse_id: 100000,
|
|
store_id: 1,
|
|
delivery_order_code: 'O102',
|
|
post_status: 'fin',
|
|
sys_platform_code: 'kuaishou',
|
|
},
|
|
]);
|
|
service.filterFullyAssignedExpressWaves = () => ({
|
|
validWaveIds: [ 1 ],
|
|
filteredWaveIds: [],
|
|
});
|
|
service.queryOrderExpressByOrderIds = async () => ([
|
|
{
|
|
order_id: 101,
|
|
business_key: 1,
|
|
waybill_code: 'WB101',
|
|
},
|
|
{
|
|
order_id: 102,
|
|
business_key: 1,
|
|
waybill_code: '',
|
|
},
|
|
]);
|
|
|
|
await assert.rejects(
|
|
async () => service.getWavePlatformPrintData({
|
|
waveIds: [ 1 ],
|
|
warehouseId: 100000,
|
|
}),
|
|
error => {
|
|
assert.ok(error instanceof Error);
|
|
assert.ok(error.message.includes('业务id为1的运单号数据缺失'));
|
|
return true;
|
|
}
|
|
);
|
|
});
|
|
|
|
it('should return waveGroups grouped by wave then platform+sys_logistics and keep summary counters correct', async () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
|
|
service.queryWavesByIds = async () => ([
|
|
{ wave_id: 2, wave_no: 'W002' },
|
|
{ wave_id: 1, wave_no: 'W001' },
|
|
]);
|
|
|
|
service.queryOrdersByWaveIds = async () => ([
|
|
{
|
|
id: 11,
|
|
wave_id: 1,
|
|
wave_no: 'W001',
|
|
warehouse_id: 100000,
|
|
store_id: 1,
|
|
delivery_order_code: 'O11',
|
|
post_status: 'fin',
|
|
sys_platform_code: 'jd',
|
|
},
|
|
{
|
|
id: 12,
|
|
wave_id: 1,
|
|
wave_no: 'W001',
|
|
warehouse_id: 100000,
|
|
store_id: 1,
|
|
delivery_order_code: 'O12',
|
|
post_status: 'fin',
|
|
sys_platform_code: 'cainiao',
|
|
},
|
|
{
|
|
id: 21,
|
|
wave_id: 2,
|
|
wave_no: 'W002',
|
|
warehouse_id: 100000,
|
|
store_id: 2,
|
|
delivery_order_code: 'O21',
|
|
post_status: 'fin',
|
|
sys_platform_code: 'jd',
|
|
},
|
|
]);
|
|
|
|
service.filterFullyAssignedExpressWaves = () => ({
|
|
validWaveIds: [ 2, 1 ],
|
|
filteredWaveIds: [],
|
|
});
|
|
|
|
service.queryOrderExpressByOrderIds = async () => ([
|
|
{
|
|
order_id: 11,
|
|
business_key: 1,
|
|
waybill_code: 'WB11',
|
|
},
|
|
{
|
|
order_id: 12,
|
|
business_key: 1,
|
|
waybill_code: 'WB12',
|
|
},
|
|
{
|
|
order_id: 21,
|
|
business_key: 1,
|
|
waybill_code: 'WB21',
|
|
},
|
|
]);
|
|
service.buildOrderExpressMap = () => new Map();
|
|
service.getPolicyConfigMapByStore = async () => new Map([
|
|
[ 1, {}],
|
|
[ 2, {}],
|
|
]);
|
|
service.resolvePrintPlatformCode = orderRow => String(orderRow && orderRow.sys_platform_code || '').trim();
|
|
service.loadTemplateSampleByPlatform = () => ({});
|
|
service.buildOrderPlatformPrintItem = ({ orderRow, platformCode }) => ({
|
|
wave_id: Number(orderRow.wave_id),
|
|
wave_no: String(orderRow.wave_no),
|
|
order_id: Number(orderRow.id),
|
|
order_no: String(orderRow.delivery_order_code),
|
|
platform: String(platformCode),
|
|
platform_name: platformCode === 'jd' ? '京东' : '菜鸟',
|
|
print_data: {
|
|
platform: String(platformCode),
|
|
order_id: Number(orderRow.id),
|
|
},
|
|
});
|
|
|
|
const result = await service.getWavePlatformPrintData({
|
|
waveIds: [ 2, 1 ],
|
|
warehouseId: 100000,
|
|
});
|
|
|
|
assert.deepEqual(result.summary, {
|
|
total_waves: 2,
|
|
total_orders: 3,
|
|
total_platforms: 3,
|
|
locked_count: 0,
|
|
total_locked_orders: 0,
|
|
});
|
|
|
|
assert.equal(result.waveGroups.length, 2);
|
|
assert.deepEqual(result.waveGroups.map(item => item.wave_no), [ 'W001', 'W002' ]);
|
|
|
|
assert.deepEqual(result.waveGroups[0], {
|
|
wave_id: 1,
|
|
wave_no: 'W001',
|
|
order_count: 2,
|
|
platforms: [
|
|
{
|
|
platform: 'cainiao',
|
|
platform_name: '菜鸟',
|
|
sys_logistics_code: 'unknown',
|
|
sys_logistics_name: 'unknown',
|
|
order_count: 1,
|
|
order_ids: [ 12 ],
|
|
orders: [
|
|
{
|
|
platform: 'cainiao',
|
|
order_id: 12,
|
|
},
|
|
],
|
|
},
|
|
{
|
|
platform: 'jd',
|
|
platform_name: '京东',
|
|
sys_logistics_code: 'unknown',
|
|
sys_logistics_name: 'unknown',
|
|
order_count: 1,
|
|
order_ids: [ 11 ],
|
|
orders: [
|
|
{
|
|
platform: 'jd',
|
|
order_id: 11,
|
|
},
|
|
],
|
|
},
|
|
],
|
|
});
|
|
|
|
assert.deepEqual(result.waveGroups[1], {
|
|
wave_id: 2,
|
|
wave_no: 'W002',
|
|
order_count: 1,
|
|
platforms: [
|
|
{
|
|
platform: 'jd',
|
|
platform_name: '京东',
|
|
sys_logistics_code: 'unknown',
|
|
sys_logistics_name: 'unknown',
|
|
order_count: 1,
|
|
order_ids: [ 21 ],
|
|
orders: [
|
|
{
|
|
platform: 'jd',
|
|
order_id: 21,
|
|
},
|
|
],
|
|
},
|
|
],
|
|
});
|
|
|
|
assert.deepEqual(result.ext, {
|
|
missing_wave_ids: [],
|
|
filtered_wave_ids: [],
|
|
});
|
|
});
|
|
|
|
it('should group platform orders by platform+sys_logistics as flattened platform items', () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
|
|
const waveGroups = service.groupOrderPrintItemsByWaveAndPlatform({
|
|
waveRows: [
|
|
{ wave_id: 1, wave_no: 'W001' },
|
|
],
|
|
hitWaveIds: [ 1 ],
|
|
orderPrintList: [
|
|
{
|
|
wave_id: 1,
|
|
order_id: 11,
|
|
platform: 'jd',
|
|
platform_name: '京东',
|
|
sys_logistics_code: 'ZTO',
|
|
sys_logistics_name: '中通快递',
|
|
print_data: { order_id: 11 },
|
|
},
|
|
{
|
|
wave_id: 1,
|
|
order_id: 12,
|
|
platform: 'jd',
|
|
platform_name: '京东',
|
|
sys_logistics_code: 'YTO',
|
|
sys_logistics_name: '圆通速递',
|
|
print_data: { order_id: 12 },
|
|
},
|
|
{
|
|
wave_id: 1,
|
|
order_id: 13,
|
|
platform: 'jd',
|
|
platform_name: '京东',
|
|
sys_logistics_code: 'ZTO',
|
|
sys_logistics_name: '中通快递',
|
|
print_data: { order_id: 13 },
|
|
},
|
|
{
|
|
wave_id: 1,
|
|
order_id: 14,
|
|
platform: 'jd',
|
|
platform_name: '京东',
|
|
sys_logistics_code: '',
|
|
sys_logistics_name: '',
|
|
print_data: { order_id: 14 },
|
|
},
|
|
],
|
|
});
|
|
|
|
assert.equal(waveGroups.length, 1);
|
|
assert.equal(waveGroups[0].platforms.length, 3);
|
|
assert.equal(waveGroups[0].order_count, 4);
|
|
|
|
const ztoGroup = waveGroups[0].platforms.find(item => item && item.sys_logistics_code === 'ZTO');
|
|
assert.ok(ztoGroup);
|
|
assert.deepEqual(ztoGroup, {
|
|
platform: 'jd',
|
|
platform_name: '京东',
|
|
sys_logistics_code: 'ZTO',
|
|
sys_logistics_name: '中通快递',
|
|
order_count: 2,
|
|
order_ids: [ 11, 13 ],
|
|
orders: [
|
|
{ order_id: 11 },
|
|
{ order_id: 13 },
|
|
],
|
|
});
|
|
|
|
const ytoGroup = waveGroups[0].platforms.find(item => item && item.sys_logistics_code === 'YTO');
|
|
assert.ok(ytoGroup);
|
|
assert.deepEqual(ytoGroup, {
|
|
platform: 'jd',
|
|
platform_name: '京东',
|
|
sys_logistics_code: 'YTO',
|
|
sys_logistics_name: '圆通速递',
|
|
order_count: 1,
|
|
order_ids: [ 12 ],
|
|
orders: [
|
|
{ order_id: 12 },
|
|
],
|
|
});
|
|
|
|
const unknownGroup = waveGroups[0].platforms.find(item => item && item.sys_logistics_code === 'unknown');
|
|
assert.ok(unknownGroup);
|
|
assert.deepEqual(unknownGroup, {
|
|
platform: 'jd',
|
|
platform_name: '京东',
|
|
sys_logistics_code: 'unknown',
|
|
sys_logistics_name: 'unknown',
|
|
order_count: 1,
|
|
order_ids: [ 14 ],
|
|
orders: [
|
|
{ order_id: 14 },
|
|
],
|
|
});
|
|
});
|
|
|
|
it('should batch load picking locations from wms_picking for print items', async () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
const currentOrderItemsModel = {
|
|
async findAll() {
|
|
return [
|
|
{
|
|
id: 5001,
|
|
order_id: 301,
|
|
item_code: 'SKU-301',
|
|
item_name: '商品301',
|
|
plan_qty: 1,
|
|
item_snapshot: {
|
|
barcode: '9988776655443',
|
|
},
|
|
},
|
|
];
|
|
},
|
|
};
|
|
|
|
service.ctx.model.Picking = {
|
|
async findAll() {
|
|
return [
|
|
{
|
|
id: 1,
|
|
order_id: 301,
|
|
order_item_id: 5001,
|
|
quantity: 1,
|
|
space_id: 9001,
|
|
space_name: 'E2区08-05-02',
|
|
status: 'pending',
|
|
},
|
|
];
|
|
},
|
|
};
|
|
service.ctx.model.OrderItemsFactory = {
|
|
async getCurrentModel() {
|
|
return currentOrderItemsModel;
|
|
},
|
|
};
|
|
service.ctx.model.LocationSpace = {
|
|
async findAll() {
|
|
throw new Error('space_name 已存在时不应查询库位表');
|
|
},
|
|
};
|
|
|
|
service.queryWavesByIds = async () => ([
|
|
{ wave_id: 30, wave_no: 'W030' },
|
|
]);
|
|
service.queryOrdersByWaveIds = async () => ([
|
|
{
|
|
id: 301,
|
|
wave_id: 30,
|
|
wave_no: 'W030',
|
|
warehouse_id: 100000,
|
|
store_id: 1,
|
|
delivery_order_code: 'O301',
|
|
post_status: 'fin',
|
|
sys_platform_code: 'pdd',
|
|
items: '',
|
|
},
|
|
]);
|
|
service.filterFullyAssignedExpressWaves = () => ({
|
|
validWaveIds: [ 30 ],
|
|
filteredWaveIds: [],
|
|
});
|
|
service.queryOrderExpressByOrderIds = async () => ([
|
|
{
|
|
order_id: 301,
|
|
business_key: 1,
|
|
waybill_code: 'WB301',
|
|
logistics_name: '顺丰空运',
|
|
},
|
|
]);
|
|
service.queryWaveOrderIndexMapByOrderIds = async () => new Map([
|
|
[ 301, {
|
|
wave_id: 30,
|
|
wave_index: 12,
|
|
platforms_index: 3,
|
|
}],
|
|
]);
|
|
service.queryWaveTotalOrderCountMap = async () => new Map([
|
|
[ 30, 66 ],
|
|
]);
|
|
service.getPolicyConfigMapByStore = async () => new Map([
|
|
[ 1, {
|
|
waybill_custom_display_type: '4',
|
|
}],
|
|
]);
|
|
service.loadTemplateSampleByPlatform = () => ({
|
|
cmd: 'print',
|
|
requestID: 'REQ-301',
|
|
version: '11',
|
|
task: {
|
|
documents: [
|
|
{
|
|
contents: [
|
|
{
|
|
addData: {
|
|
sender: {
|
|
address: {},
|
|
},
|
|
},
|
|
encryptedData: '',
|
|
signature: '',
|
|
templateUrl: 'https://file-link.pinduoduo.com/sto_one',
|
|
userid: '',
|
|
ver: '11',
|
|
},
|
|
{
|
|
templateURL: 'http://www.ye4s.com/mb/pdd.xml',
|
|
data: {
|
|
height: 240,
|
|
list: [
|
|
{
|
|
fontSize: 28,
|
|
left: 2.08,
|
|
text: '',
|
|
top: 2.08,
|
|
width: 550,
|
|
},
|
|
],
|
|
waterdata: {
|
|
text: '',
|
|
},
|
|
width: 560,
|
|
},
|
|
},
|
|
],
|
|
documentID: 'DOC-301',
|
|
},
|
|
],
|
|
},
|
|
});
|
|
|
|
const result = await service.getWavePlatformPrintData({
|
|
waveIds: [ 30 ],
|
|
warehouseId: 100000,
|
|
});
|
|
|
|
const printText = result.waveGroups[0].platforms[0].orders[0].contents[1].data.list[0].text;
|
|
assert.ok(printText.includes('【66】W030_12_3'));
|
|
assert.ok(printText.includes('E2区08-05-02 55443 【1】'));
|
|
});
|
|
|
|
it('should use real order wave_id for wave total count when wave index has dirty wave_id', async () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
let capturedWaveIdsForIndexQuery = [];
|
|
let capturedWaveIdsForCountQuery = [];
|
|
|
|
service.queryWavesByIds = async () => ([
|
|
{ wave_id: 40, wave_no: 'W040' },
|
|
]);
|
|
service.queryOrdersByWaveIds = async () => ([
|
|
{
|
|
id: 401,
|
|
wave_id: 40,
|
|
wave_no: 'W040',
|
|
warehouse_id: 100000,
|
|
store_id: 1,
|
|
delivery_order_code: 'O401',
|
|
post_status: 'fin',
|
|
sys_platform_code: 'pdd',
|
|
},
|
|
]);
|
|
service.filterFullyAssignedExpressWaves = () => ({
|
|
validWaveIds: [ 40 ],
|
|
filteredWaveIds: [],
|
|
});
|
|
service.queryOrderExpressByOrderIds = async () => ([
|
|
{
|
|
order_id: 401,
|
|
business_key: 1,
|
|
waybill_code: 'WB401',
|
|
},
|
|
]);
|
|
service.getPolicyConfigMapByStore = async () => new Map([
|
|
[ 1, {}],
|
|
]);
|
|
service.queryWaveOrderIndexMapByOrderIds = async (orderIds, warehouseId, waveIds) => {
|
|
capturedWaveIdsForIndexQuery = Array.isArray(waveIds) ? waveIds : [];
|
|
assert.deepEqual(orderIds, [ 401 ]);
|
|
assert.equal(warehouseId, 100000);
|
|
|
|
return new Map([
|
|
[ 401, {
|
|
wave_id: 999,
|
|
wave_index: 7,
|
|
platforms_index: 2,
|
|
}],
|
|
]);
|
|
};
|
|
service.queryWaveTotalOrderCountMap = async waveIds => {
|
|
capturedWaveIdsForCountQuery = Array.isArray(waveIds) ? waveIds : [];
|
|
return new Map([
|
|
[ 40, 66 ],
|
|
[ 999, 1 ],
|
|
]);
|
|
};
|
|
service.loadTemplateSampleByPlatform = () => ({});
|
|
service.buildOrderPlatformPrintItem = ({ orderRow, platformCode }) => ({
|
|
wave_id: Number(orderRow.wave_id || 0),
|
|
platform: String(platformCode || ''),
|
|
platform_name: '拼多多',
|
|
print_data: {
|
|
order_id: Number(orderRow.id || 0),
|
|
wave_total_orders: Number(orderRow.wave_total_orders || 0),
|
|
},
|
|
});
|
|
|
|
const result = await service.getWavePlatformPrintData({
|
|
waveIds: [ 40 ],
|
|
warehouseId: 100000,
|
|
});
|
|
|
|
assert.deepEqual(capturedWaveIdsForIndexQuery, [ 40 ]);
|
|
assert.deepEqual(capturedWaveIdsForCountQuery, [ 40 ]);
|
|
assert.ok(!capturedWaveIdsForCountQuery.includes(999));
|
|
assert.equal(result.waveGroups[0].platforms[0].orders[0].wave_total_orders, 66);
|
|
});
|
|
|
|
it('should prefer snapshot item_name for display type 2 in getWavePlatformPrintData', async () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
const currentOrderItemsModel = {
|
|
async findAll() {
|
|
return [
|
|
{
|
|
id: 6001,
|
|
order_id: 302,
|
|
item_code: 'SKU-302',
|
|
item_name: '旧商品名-不应展示',
|
|
plan_qty: 1,
|
|
item_snapshot: {
|
|
item_name: '快照商品名-应展示',
|
|
},
|
|
},
|
|
];
|
|
},
|
|
};
|
|
|
|
service.ctx.model.Picking = {
|
|
async findAll() {
|
|
return [
|
|
{
|
|
id: 2,
|
|
order_id: 302,
|
|
order_item_id: 6001,
|
|
quantity: 1,
|
|
space_id: 9101,
|
|
space_name: 'A1区01-01-01',
|
|
status: 'pending',
|
|
},
|
|
];
|
|
},
|
|
};
|
|
service.ctx.model.OrderItemsFactory = {
|
|
async getCurrentModel() {
|
|
return currentOrderItemsModel;
|
|
},
|
|
};
|
|
service.ctx.model.LocationSpace = {
|
|
async findAll() {
|
|
throw new Error('space_name 已存在时不应查询库位表');
|
|
},
|
|
};
|
|
|
|
service.queryWavesByIds = async () => ([
|
|
{ wave_id: 31, wave_no: 'W031' },
|
|
]);
|
|
service.queryOrdersByWaveIds = async () => ([
|
|
{
|
|
id: 302,
|
|
wave_id: 31,
|
|
wave_no: 'W031',
|
|
warehouse_id: 100000,
|
|
store_id: 1,
|
|
delivery_order_code: 'O302',
|
|
post_status: 'fin',
|
|
sys_platform_code: 'pdd',
|
|
items: '',
|
|
},
|
|
]);
|
|
service.filterFullyAssignedExpressWaves = () => ({
|
|
validWaveIds: [ 31 ],
|
|
filteredWaveIds: [],
|
|
});
|
|
service.queryOrderExpressByOrderIds = async () => ([
|
|
{
|
|
order_id: 302,
|
|
business_key: 1,
|
|
waybill_code: 'WB302',
|
|
logistics_name: '圆通',
|
|
},
|
|
]);
|
|
service.queryWaveOrderIndexMapByOrderIds = async () => new Map([
|
|
[ 302, {
|
|
wave_id: 31,
|
|
wave_index: 1,
|
|
platforms_index: 1,
|
|
}],
|
|
]);
|
|
service.queryWaveTotalOrderCountMap = async () => new Map([
|
|
[ 31, 10 ],
|
|
]);
|
|
service.getPolicyConfigMapByStore = async () => new Map([
|
|
[ 1, {
|
|
waybill_custom_display_type: '2',
|
|
}],
|
|
]);
|
|
service.loadTemplateSampleByPlatform = () => ({
|
|
cmd: 'print',
|
|
requestID: 'REQ-302',
|
|
version: '11',
|
|
task: {
|
|
documents: [
|
|
{
|
|
contents: [
|
|
{
|
|
addData: {
|
|
sender: {
|
|
address: {},
|
|
},
|
|
},
|
|
encryptedData: '',
|
|
signature: '',
|
|
templateUrl: 'https://file-link.pinduoduo.com/sto_one',
|
|
userid: '',
|
|
ver: '11',
|
|
},
|
|
{
|
|
templateURL: 'http://www.ye4s.com/mb/pdd.xml',
|
|
data: {
|
|
height: 240,
|
|
list: [
|
|
{
|
|
fontSize: 28,
|
|
left: 2.08,
|
|
text: '',
|
|
top: 2.08,
|
|
width: 550,
|
|
},
|
|
],
|
|
waterdata: {
|
|
text: '',
|
|
},
|
|
width: 560,
|
|
},
|
|
},
|
|
],
|
|
documentID: 'DOC-302',
|
|
},
|
|
],
|
|
},
|
|
});
|
|
|
|
const result = await service.getWavePlatformPrintData({
|
|
waveIds: [ 31 ],
|
|
warehouseId: 100000,
|
|
});
|
|
|
|
const printText = result.waveGroups[0].platforms[0].orders[0].contents[1].data.list[0].text;
|
|
assert.ok(printText.includes('快照商品名-应展示'));
|
|
assert.ok(!printText.includes('旧商品名-不应展示'));
|
|
});
|
|
|
|
it('should return locked_wave_groups when all orders are locked', async () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
|
|
service.queryWavesByIds = async () => ([
|
|
{ wave_id: 50, wave_no: 'W050' },
|
|
]);
|
|
service.queryOrdersByWaveIds = async () => ([
|
|
{
|
|
id: 501,
|
|
wave_id: 50,
|
|
wave_no: 'W050',
|
|
warehouse_id: 100000,
|
|
store_id: 1,
|
|
delivery_order_code: 'O501',
|
|
source_order_codes: 'SO501',
|
|
post_status: 'fin',
|
|
print_lock_status: 'warehouse',
|
|
},
|
|
]);
|
|
service.filterFullyAssignedExpressWaves = () => ({
|
|
validWaveIds: [ 50 ],
|
|
filteredWaveIds: [],
|
|
});
|
|
|
|
const result = await service.getWavePlatformPrintData({
|
|
waveIds: [ 50 ],
|
|
warehouseId: 100000,
|
|
});
|
|
|
|
assert.equal(result.summary.total_orders, 0);
|
|
assert.equal(result.summary.total_locked_orders, 1);
|
|
assert.equal(result.summary.locked_count, 1);
|
|
assert.equal(result.locked_count, 1);
|
|
assert.deepEqual(result.waveGroups, []);
|
|
assert.equal(result.locked_wave_groups.length, 1);
|
|
assert.equal(result.locked_wave_groups[0].wave_id, 50);
|
|
assert.equal(result.locked_wave_groups[0].order_count, 1);
|
|
assert.equal(result.locked_wave_groups[0].platforms.length, 1);
|
|
assert.equal(result.locked_wave_groups[0].platforms[0].order_count, 1);
|
|
assert.equal(result.locked_wave_groups[0].platforms[0].orders[0].status, 'locked');
|
|
assert.equal(result.locked_wave_groups[0].platforms[0].orders[0].status_text, '已锁定');
|
|
assert.equal(result.locked_orders[0].order_id, 501);
|
|
assert.equal(result.locked_orders[0].print_lock_status, 'warehouse');
|
|
assert.equal(result.locked_orders[0].status, 'locked');
|
|
assert.equal(result.locked_orders[0].status_text, '已锁定');
|
|
});
|
|
|
|
it('should separate locked and unlocked orders into waveGroups and locked_wave_groups', async () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
|
|
service.queryWavesByIds = async () => ([
|
|
{ wave_id: 60, wave_no: 'W060' },
|
|
]);
|
|
service.queryOrdersByWaveIds = async () => ([
|
|
{
|
|
id: 601,
|
|
wave_id: 60,
|
|
wave_no: 'W060',
|
|
warehouse_id: 100000,
|
|
store_id: 1,
|
|
delivery_order_code: 'O601',
|
|
post_status: 'fin',
|
|
print_lock_status: 'warehouse',
|
|
sys_platform_code: 'jd',
|
|
},
|
|
{
|
|
id: 602,
|
|
wave_id: 60,
|
|
wave_no: 'W060',
|
|
warehouse_id: 100000,
|
|
store_id: 1,
|
|
delivery_order_code: 'O602',
|
|
post_status: 'fin',
|
|
print_lock_status: 'none',
|
|
sys_platform_code: 'jd',
|
|
},
|
|
]);
|
|
service.filterFullyAssignedExpressWaves = () => ({
|
|
validWaveIds: [ 60 ],
|
|
filteredWaveIds: [],
|
|
});
|
|
service.queryOrderExpressByOrderIds = async orderIds => {
|
|
assert.deepEqual(orderIds, [ 602 ]);
|
|
return [
|
|
{
|
|
order_id: 602,
|
|
business_key: 1,
|
|
waybill_code: 'WB602',
|
|
},
|
|
];
|
|
};
|
|
service.getPolicyConfigMapByStore = async () => new Map([
|
|
[ 1, {}],
|
|
]);
|
|
service.queryWaveOrderIndexMapByOrderIds = async () => new Map();
|
|
service.queryWaveTotalOrderCountMap = async () => new Map();
|
|
service.buildOrderExpressMap = rows => new Map((Array.isArray(rows) ? rows : []).map(row => [ row.order_id, row ]));
|
|
service.resolvePrintPlatformCode = orderRow => String(orderRow && orderRow.sys_platform_code || '').trim();
|
|
service.loadTemplateSampleByPlatform = () => ({});
|
|
service.buildOrderPlatformPrintItem = ({ orderRow, platformCode }) => ({
|
|
wave_id: Number(orderRow.wave_id),
|
|
wave_no: String(orderRow.wave_no),
|
|
order_id: Number(orderRow.id),
|
|
order_no: String(orderRow.delivery_order_code),
|
|
platform: String(platformCode),
|
|
platform_name: '京东',
|
|
print_data: {
|
|
order_id: Number(orderRow.id),
|
|
status: 'ready',
|
|
},
|
|
});
|
|
|
|
const result = await service.getWavePlatformPrintData({
|
|
waveIds: [ 60 ],
|
|
warehouseId: 100000,
|
|
});
|
|
|
|
assert.equal(result.waveGroups.length, 1);
|
|
assert.deepEqual(result.waveGroups[0].platforms[0].order_ids, [ 602 ]);
|
|
assert.equal(result.waveGroups[0].platforms[0].orders[0].status, 'ready');
|
|
|
|
assert.equal(result.locked_wave_groups.length, 1);
|
|
assert.deepEqual(result.locked_wave_groups[0].platforms[0].order_ids, [ 601 ]);
|
|
assert.equal(result.locked_wave_groups[0].platforms[0].orders[0].status, 'locked');
|
|
assert.equal(result.locked_wave_groups[0].platforms[0].orders[0].status_text, '已锁定');
|
|
|
|
assert.equal(result.locked_count, 1);
|
|
assert.equal(result.locked_orders.length, 1);
|
|
assert.equal(result.locked_orders[0].order_id, 601);
|
|
assert.equal(result.summary.total_orders, 1);
|
|
assert.equal(result.summary.locked_count, 1);
|
|
assert.equal(result.summary.total_locked_orders, 1);
|
|
});
|
|
|
|
it('should prefer order_express platform_code for wave platform print data', async () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
|
|
service.queryWavesByIds = async () => ([
|
|
{ wave_id: 70, wave_no: 'W070' },
|
|
]);
|
|
service.queryOrdersByWaveIds = async () => ([
|
|
{
|
|
id: 701,
|
|
wave_id: 70,
|
|
wave_no: 'W070',
|
|
warehouse_id: 100000,
|
|
store_id: 1,
|
|
delivery_order_code: 'O701',
|
|
post_status: 'fin',
|
|
print_lock_status: 'none',
|
|
sys_platform_code: 'TB',
|
|
},
|
|
]);
|
|
service.filterFullyAssignedExpressWaves = () => ({
|
|
validWaveIds: [ 70 ],
|
|
filteredWaveIds: [],
|
|
});
|
|
service.queryOrderExpressByOrderIds = async () => ([
|
|
{
|
|
order_id: 701,
|
|
business_key: 1,
|
|
waybill_code: 'WB701',
|
|
platform_code: 'CAINIAO',
|
|
},
|
|
]);
|
|
service.getPolicyConfigMapByStore = async () => new Map([
|
|
[ 1, {}],
|
|
]);
|
|
service.queryWaveOrderIndexMapByOrderIds = async () => new Map();
|
|
service.queryWaveTotalOrderCountMap = async () => new Map();
|
|
service.buildOrderExpressMap = rows => new Map((Array.isArray(rows) ? rows : []).map(row => [ row.order_id, row ]));
|
|
service.loadTemplateSampleByPlatform = () => ({});
|
|
service.buildOrderPlatformPrintItem = ({ orderRow, platformCode }) => ({
|
|
wave_id: Number(orderRow.wave_id),
|
|
wave_no: String(orderRow.wave_no),
|
|
order_id: Number(orderRow.id),
|
|
order_no: String(orderRow.delivery_order_code),
|
|
platform: String(platformCode),
|
|
platform_name: platformCode === 'CAINIAO' ? '菜鸟' : '淘宝',
|
|
print_data: {
|
|
order_id: Number(orderRow.id),
|
|
platform: String(platformCode),
|
|
},
|
|
});
|
|
|
|
const result = await service.getWavePlatformPrintData({
|
|
waveIds: [ 70 ],
|
|
warehouseId: 100000,
|
|
});
|
|
|
|
assert.equal(result.waveGroups[0].platforms[0].platform, 'CAINIAO');
|
|
assert.equal(result.waveGroups[0].platforms[0].platform_name, '菜鸟');
|
|
});
|
|
|
|
it('should enrich cainiao cpCode and main template url before building print data', async () => {
|
|
const service = createOrderPrintServiceHarness();
|
|
const captured = {
|
|
expressCodes: null,
|
|
interfacePayload: null,
|
|
pickArgs: null,
|
|
orderExpress: null,
|
|
};
|
|
|
|
service.queryWavesByIds = async () => ([
|
|
{ wave_id: 80, wave_no: 'W080' },
|
|
]);
|
|
service.queryOrdersByWaveIds = async () => ([
|
|
{
|
|
id: 801,
|
|
wave_id: 80,
|
|
wave_no: 'W080',
|
|
warehouse_id: 100000,
|
|
store_id: 1,
|
|
delivery_order_code: 'O801',
|
|
post_status: 'fin',
|
|
sys_platform_code: 'cainiao',
|
|
sys_logistics_code: 'YTO_SYS',
|
|
logistics_code: 'YTO',
|
|
},
|
|
]);
|
|
service.filterFullyAssignedExpressWaves = () => ({
|
|
validWaveIds: [ 80 ],
|
|
filteredWaveIds: [],
|
|
});
|
|
service.queryOrderExpressByOrderIds = async () => ([
|
|
{
|
|
order_id: 801,
|
|
business_key: 1,
|
|
waybill_code: 'WB801',
|
|
logistics_code: 'YTO',
|
|
platform_code: 'CAINIAO',
|
|
},
|
|
]);
|
|
service.getPolicyConfigMapByStore = async () => new Map([
|
|
[ 1, {}],
|
|
]);
|
|
service.queryWaveOrderIndexMapByOrderIds = async () => new Map();
|
|
service.queryWaveTotalOrderCountMap = async () => new Map();
|
|
service.loadTemplateSampleByPlatform = () => ({});
|
|
service.ctx.model.Express.findAll = async options => {
|
|
captured.expressCodes = options && options.where && options.where.code && options.where.code[Symbol.for('sequelize.operator.in')];
|
|
return [
|
|
{
|
|
code: 'YTO_SYS',
|
|
CAINIAO: 'YTO_CAINIAO',
|
|
},
|
|
];
|
|
};
|
|
service.ctx.service.systems.setting.expressInterface.listByWarehousePlatformCode = async payload => {
|
|
captured.interfacePayload = payload;
|
|
return {
|
|
code: 200,
|
|
data: [
|
|
{
|
|
id: 1,
|
|
sys_express_code: 'YTO_SYS',
|
|
express_code: 'YTO',
|
|
template_url: 'https://example.com/cainiao/order-main.xml',
|
|
express: {
|
|
CAINIAO: 'YTO_CAINIAO',
|
|
},
|
|
},
|
|
],
|
|
};
|
|
};
|
|
service.ctx.service.systems.express.pickWaybillExpressInterface = (interfaceList, groupedOrder, matchedPlatform) => {
|
|
captured.pickArgs = {
|
|
interfaceList,
|
|
groupedOrder,
|
|
matchedPlatform,
|
|
};
|
|
return interfaceList[0];
|
|
};
|
|
service.buildOrderPlatformPrintItem = ({ orderExpress }) => {
|
|
captured.orderExpress = orderExpress;
|
|
return {
|
|
wave_id: 80,
|
|
wave_no: 'W080',
|
|
order_id: 801,
|
|
order_no: 'O801',
|
|
platform: 'CAINIAO',
|
|
platform_name: '菜鸟',
|
|
sys_logistics_code: 'YTO_SYS',
|
|
sys_logistics_name: '圆通',
|
|
waybill_code: 'WB801',
|
|
print_data: {
|
|
order_id: 801,
|
|
},
|
|
};
|
|
};
|
|
|
|
const result = await service.getWavePlatformPrintData({
|
|
waveIds: [ 80 ],
|
|
warehouseId: 100000,
|
|
});
|
|
|
|
assert.equal(result.waveGroups.length, 1);
|
|
assert.deepEqual(captured.interfacePayload, {
|
|
warehouseId: 100000,
|
|
platformCode: 'CAINIAO',
|
|
});
|
|
assert.equal(captured.pickArgs.groupedOrder.options.logistics_code, 'YTO');
|
|
assert.equal(captured.pickArgs.matchedPlatform.code, 'CAINIAO');
|
|
assert.equal(captured.orderExpress.cainiao_cp_code, 'YTO_CAINIAO');
|
|
assert.equal(captured.orderExpress.cainiao_template_url, 'https://example.com/cainiao/order-main.xml');
|
|
});
|
|
});
|