feat(pl): 在现场日历复制文本中统计入库和出库车次。

便于按产品一眼看出入出数量,并把入库明细排在出库前面。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
wuzilongandCursor committed 2026-11-07 12:41:07 +08:00
1 parent 66bad6b219
commit 8e679da8e3
2 files changed
+79 -10

No files matched your search

@@ -151,6 +151,12 @@ test('数量是可空文本,复制逐条展示,日汇总仍只计车次', ()
})
test('现场复制隐藏起止地和备注,单据类型放在每条记录末尾的中文括号中', () => {
const summary: Record<string, string> = {
入库计划: '(入2车)',
出库计划: '(出2车)',
出入库计划: '',
现场调拨: ''
}
for (const documentType of ['入库计划', '出库计划', '出入库计划', '现场调拨']) {
const record = {
...row('site'),
@@ -165,7 +171,7 @@ test('现场复制隐藏起止地和备注,单据类型放在每条记录末
[
'2026-10-26 派车计划:',
'',
'液碱2车',
`液碱 2车${summary[documentType]}`,
` ·皖H12345 液碱 32.50吨(${documentType})`,
` ·皖H12345 液碱(${documentType})`
]
@@ -185,7 +191,7 @@ test('现场复制隐藏起止地和备注,单据类型放在每条记录末
}
assert.equal(
manualCopyText('2026-10-26', [record]),
'2026-10-26 派车计划:\n\n液碱1车\n ·皖H12345 液碱'
'2026-10-26 派车计划:\n\n液碱 1车\n ·皖H12345 液碱'
)
}
})
@@ -226,12 +232,12 @@ test('现场按产品分组统计,交错产品集中展示且符合指定复
[
'2026-11-01 派车计划:',
'',
'98% 工业硫酸1车',
'98% 工业硫酸 1车(出1车)',
' ·皖H10291 98% 工业硫酸 32吨(出库计划)',
'精制硫酸2车',
'精制硫酸 2车(出2车)',
' ·皖H57837 精制硫酸 32吨(出库计划)',
' ·皖HA3190 精制硫酸 32吨(出库计划)',
'50% 工业硫酸1车',
'50% 工业硫酸 1车(出1车)',
' ·皖HA3690 50% 工业硫酸 28吨(出库计划)'
].join('\n')
)
@@ -241,6 +247,40 @@ test('现场按产品分组统计,交错产品集中展示且符合指定复
)
})
test('现场产品组统计入出车次,入库排在出库前面,其他类型不计入入出', () => {
const site = (
id: string,
licensePlate: string,
documentType: string,
createTime: string
) => ({
...row(id, '2026-11-01', licensePlate),
calendarKind: 'site' as const,
productName: '98%工业硫酸',
licensePlate,
quantity: '32',
documentType,
createTime
})
assert.equal(
manualCopyText('2026-11-01', [
site('out-later', '皖H58559', '出库计划', '2026-11-01 10:00:00'),
site('direct', '皖H10001', '直销计划', '2026-11-01 07:00:00'),
site('in', '皖H57837', ' 入库计划 ', '2026-11-01 11:00:00'),
site('out-early', '皖H56153', '出库计划', '2026-11-01 08:00:00')
]),
[
'2026-11-01 派车计划:',
'',
'98%工业硫酸 4车(入1车 出2车)',
' ·皖H57837 98%工业硫酸 32吨(入库计划)',
' ·皖H56153 98%工业硫酸 32吨(出库计划)',
' ·皖H58559 98%工业硫酸 32吨(出库计划)',
' ·皖H10001 98%工业硫酸 32吨(直销计划)'
].join('\n')
)
})
test('现场同车重复记录逐条计车,同名不同产品ID保持独立且组内按创建顺序', () => {
const first = { ...row('1'), calendarKind: 'site' as const, createTime: '2026-10-26 01:00:00' }
const later = { ...first, id: '2', createTime: '2026-10-26 02:00:00', quantity: '20' }
@@ -250,10 +290,10 @@ test('现场同车重复记录逐条计车,同名不同产品ID保持独立且
[
'2026-10-26 派车计划:',
'',
'液碱2车',
'液碱 2车',
' ·皖H12345 液碱',
' ·皖H12345 液碱 20吨',
'液碱1车',
'液碱 1车',
' ·皖H12345 液碱'
].join('\n')
)