feat(cleaner-history): record missing orders with production ID tracking

Record ALL input orders in history, including resolution failures (not_found)
and ERP query misses (erp_not_found). Add ProductionId column to track original
总排号 input. Add 总排号 column and new status styles to the history UI. Fix
empty result caching that prevented retry on transient query failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-04-14 10:08:15 +08:00
parent 95eb44979a
commit 6f49596467
9 changed files with 278 additions and 39 deletions

View File

@@ -242,7 +242,7 @@ describe('CleanerApplicationService', () => {
).rejects.toBeInstanceOf(DatabaseQueryError)
})
it('should reject with ValidationError when no valid order numbers are provided', async () => {
it('should return empty result when no valid order numbers are provided', async () => {
;(service as any).getErpConfig = vi
.fn()
.mockResolvedValue({ url: 'u', username: 'x', password: 'p' })
@@ -250,9 +250,13 @@ describe('CleanerApplicationService', () => {
disconnect: vi.fn().mockResolvedValue(undefined)
})
await expect(
service.runCleaner({ send: vi.fn() } as any, makeInput({ orderNumbers: [] }))
).rejects.toThrow('没有有效的生产订单号可处理')
const result = await service.runCleaner(
{ send: vi.fn() } as any,
makeInput({ orderNumbers: [] })
)
expect(result.ordersProcessed).toBe(0)
expect(result.materialsDeleted).toBe(0)
expect(result.details).toEqual([])
})
it('should process orders containing empty strings without crashing', async () => {