const checkers = [ { entity: 'ship', action: ['syncPaths', 'syncState', 'syncAll'], type: 'row', filter: { iState: { $in: ['unshipped', 'shipping'], } } }, { entity: 'ship', action: ['ship', 'receive'], type: 'row', filter: (operation, context) => { // 只有root或者未设置extraShipId的才可手动设置 const isRoot = context.isRoot(); if (isRoot) { return; } return { extraShipId: { $exists: false, }, }; } }, { entity: 'ship', action: 'print', type: 'row', filter: { entity: { $exists: true, }, entityId: { $exists: true, }, extraShipId: { $exists: true, }, iState: 'unshipped', } }, { entity: 'ship', type: 'logicalData', action: 'receive', checker: (operation) => { const { data } = operation; if (!data.receiveAt) { const now = Date.now(); data.receiveAt = now; } } }, { entity: 'ship', type: 'row', action: ['startReceiving', 'succeedReceiving'], filter: { $or: [ { type: 'virtual', }, { shipOrder$ship: { order: { pay$order: { wpProduct: { needReceiving: true } } } } } ] } }, { entity: 'ship', type: 'row', action: 'receive', filter: { shipOrder$ship: { '#sqp': 'all', order: { pay$order: { '#sqp': 'not in', wpProduct: { needReceiving: true } } } } } } ]; export default checkers;