feat: edit collaboration remarks across order loading

This commit is contained in:
2026-09-14 16:56:11 +08:00
parent 33520e8fd3
commit 9e28e10e5f
16 changed files with 125 additions and 78 deletions
@@ -9,7 +9,7 @@ import {
preparePalletLabels,
printPalletLabels,
updatePreloadTransport,
updateLoadingItemWarehouseRemark,
updateLoadingItemRemarks,
} from './platformLoadingLists'
const preloadSummary = {
@@ -53,7 +53,7 @@ const detail = {
customerName: '测试客户', customsTaxMode: 'TAX_REFUND', taxRefundFlag: true, inboundCode: 'RK001', skuCode: 'SKU001', destinationWarehouse: 'ONT8', chineseName: '产品', englishName: null,
goodsImageUrl: null, unitType: 'SEALED_PALLET', palletId: 9007199254740993n, palletNo: 'PLT-001', indivisible: true, packageCount: 2, palletCount: 1, grossWeightKg: 10, netWeightKg: 9, volumeCbm: 1,
dimensionalWeightKg: 2, unitsPerPackage: 10, fbaTrackingNo: null, shipmentNo: null, shippingMark: null,
internalRemark: null, customerRemark: null, warehouseRemark: null, loadSequence: 1, frozenAt: null,
internalRemark: null, customerRemark: null, warehouseRemark: null, customerServiceRemark: null, loadSequence: 1, frozenAt: null,
}],
histories: [{ historyId: 21, itemId: 11, operationId: 'transport-21', actionType: 'UPDATE_TRANSPORT', fromStatus: 'LOADING', toStatus: 'LOADING', beforeSnapshot: null, afterSnapshot: null, operatorId: 22, operatorName: '操作员', operationReason: '调整', occurredAt: '2026-08-10T11:00:00' }],
}
@@ -108,18 +108,20 @@ describe('platform loading lists API', () => {
expect(loaded.summary.status).toBe('COMPLETED')
})
it('updates one item warehouse remark with both optimistic-lock versions and operation id', async () => {
const patch = vi.spyOn(http, 'patch').mockResolvedValue({ code: '200', message: 'ok', data: { id: 100, version: 4, items: [{ id: 11, warehouseRemark: '装柜时注意外箱', version: 5 }] } })
const result = await updateLoadingItemWarehouseRemark('100', '11', {
it('updates one item editable remarks with both optimistic-lock versions and operation id', async () => {
const patch = vi.spyOn(http, 'patch').mockResolvedValue({ code: '200', message: 'ok', data: { id: 100, version: 4, items: [{ id: 11, internalRemark: '内部', warehouseRemark: '装柜时注意外箱', customerServiceRemark: '客服', version: 5 }] } })
const result = await updateLoadingItemRemarks('100', '11', {
internalRemark: '内部',
warehouseRemark: '装柜时注意外箱',
customerServiceRemark: '客服',
expectedPlanVersion: 3,
expectedItemVersion: 4,
operationId: 'warehouse-remark-1',
})
expect(patch).toHaveBeenCalledWith(
'/platform/v1/first-leg/smart-loading/plans/100/items/11/warehouse-remark',
{ warehouseRemark: '装柜时注意外箱', expectedPlanVersion: 3, expectedItemVersion: 4, operationId: 'warehouse-remark-1' },
'/platform/v1/first-leg/smart-loading/plans/100/items/11/remarks',
{ internalRemark: '内部', warehouseRemark: '装柜时注意外箱', customerServiceRemark: '客服', expectedPlanVersion: 3, expectedItemVersion: 4, operationId: 'warehouse-remark-1' },
)
expect(result).toMatchObject({ id: '100', version: 4, items: [{ id: '11', version: 5, warehouseRemark: '装柜时注意外箱' }] })
})