当虚拟或受发货限制的自提ship发货后,自动开始确认收货流程
This commit is contained in:
parent
b202484712
commit
0572f4007a
|
|
@ -239,7 +239,7 @@ const triggers = [
|
|||
{
|
||||
name: '当物流类的ship签收后,调用小程序确认收货提醒',
|
||||
entity: 'ship',
|
||||
action: 'receive',
|
||||
action: 'startReceiving',
|
||||
when: 'commit',
|
||||
asRoot: true,
|
||||
filter: {
|
||||
|
|
@ -287,5 +287,60 @@ const triggers = [
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '当虚拟或受发货限制的自提ship发货后,自动开始确认收货流程',
|
||||
entity: 'ship',
|
||||
action: 'ship',
|
||||
when: 'commit',
|
||||
asRoot: true,
|
||||
fn: async ({ ids }, context, option) => {
|
||||
assert(ids.length === 1);
|
||||
const id = ids[0];
|
||||
const [ship] = await context.select('ship', {
|
||||
data: {
|
||||
id: 1,
|
||||
type: 1,
|
||||
receiveAt: 1,
|
||||
shipOrder$ship: {
|
||||
$entity: 'shipOrder',
|
||||
data: {
|
||||
id: 1,
|
||||
orderId: 1,
|
||||
order: {
|
||||
id: 1,
|
||||
pay$order: {
|
||||
$entity: 'pay',
|
||||
data: {
|
||||
id: 1,
|
||||
},
|
||||
filter: {
|
||||
entity: 'wpProduct',
|
||||
wpProduct: {
|
||||
needReceiving: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
filter: {
|
||||
id
|
||||
}
|
||||
}, { dontCollect: true, forUpdate: true });
|
||||
const { type, shipOrder$ship } = ship;
|
||||
const wpPay = shipOrder$ship?.map((shipOrder) => shipOrder?.order?.pay$order).flat();
|
||||
if (type === 'virtual' || (type === 'pickup' && wpPay && wpPay.length > 0)) {
|
||||
await context.operate('ship', {
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'startReceiving',
|
||||
data: {},
|
||||
filter: {
|
||||
id,
|
||||
}
|
||||
}, option);
|
||||
}
|
||||
},
|
||||
},
|
||||
];
|
||||
export default triggers;
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ const triggers = [
|
|||
{
|
||||
name: '当物流类的ship签收后,调用小程序确认收货提醒',
|
||||
entity: 'ship',
|
||||
action: 'receive',
|
||||
action: 'startReceiving',
|
||||
when: 'commit',
|
||||
asRoot: true,
|
||||
filter: {
|
||||
|
|
@ -290,5 +290,60 @@ const triggers = [
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '当虚拟或受发货限制的自提ship发货后,自动开始确认收货流程',
|
||||
entity: 'ship',
|
||||
action: 'ship',
|
||||
when: 'commit',
|
||||
asRoot: true,
|
||||
fn: async ({ ids }, context, option) => {
|
||||
(0, assert_1.default)(ids.length === 1);
|
||||
const id = ids[0];
|
||||
const [ship] = await context.select('ship', {
|
||||
data: {
|
||||
id: 1,
|
||||
type: 1,
|
||||
receiveAt: 1,
|
||||
shipOrder$ship: {
|
||||
$entity: 'shipOrder',
|
||||
data: {
|
||||
id: 1,
|
||||
orderId: 1,
|
||||
order: {
|
||||
id: 1,
|
||||
pay$order: {
|
||||
$entity: 'pay',
|
||||
data: {
|
||||
id: 1,
|
||||
},
|
||||
filter: {
|
||||
entity: 'wpProduct',
|
||||
wpProduct: {
|
||||
needReceiving: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
filter: {
|
||||
id
|
||||
}
|
||||
}, { dontCollect: true, forUpdate: true });
|
||||
const { type, shipOrder$ship } = ship;
|
||||
const wpPay = shipOrder$ship?.map((shipOrder) => shipOrder?.order?.pay$order).flat();
|
||||
if (type === 'virtual' || (type === 'pickup' && wpPay && wpPay.length > 0)) {
|
||||
await context.operate('ship', {
|
||||
id: await (0, uuid_1.generateNewIdAsync)(),
|
||||
action: 'startReceiving',
|
||||
data: {},
|
||||
filter: {
|
||||
id,
|
||||
}
|
||||
}, option);
|
||||
}
|
||||
},
|
||||
},
|
||||
];
|
||||
exports.default = triggers;
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ const triggers: Trigger<EntityDict, 'ship', BRC>[] = [
|
|||
{
|
||||
name: '当物流类的ship签收后,调用小程序确认收货提醒',
|
||||
entity: 'ship',
|
||||
action: 'receive',
|
||||
action: 'startReceiving',
|
||||
when: 'commit',
|
||||
asRoot: true,
|
||||
filter: {
|
||||
|
|
@ -300,6 +300,63 @@ const triggers: Trigger<EntityDict, 'ship', BRC>[] = [
|
|||
}
|
||||
}
|
||||
} as UpdateTriggerCrossTxn<EntityDict, 'ship', BRC>,
|
||||
{
|
||||
name: '当虚拟或受发货限制的自提ship发货后,自动开始确认收货流程',
|
||||
entity: 'ship',
|
||||
action: 'ship',
|
||||
when: 'commit',
|
||||
asRoot: true,
|
||||
fn: async ({ ids }, context, option) => {
|
||||
assert(ids.length === 1);
|
||||
const id = ids[0];
|
||||
const [ship] = await context.select('ship', {
|
||||
data: {
|
||||
id: 1,
|
||||
type: 1,
|
||||
receiveAt: 1,
|
||||
shipOrder$ship: {
|
||||
$entity: 'shipOrder',
|
||||
data: {
|
||||
id: 1,
|
||||
orderId: 1,
|
||||
order: {
|
||||
id: 1,
|
||||
pay$order: {
|
||||
$entity: 'pay',
|
||||
data: {
|
||||
id: 1,
|
||||
},
|
||||
filter: {
|
||||
entity: 'wpProduct',
|
||||
wpProduct: {
|
||||
needReceiving: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
},
|
||||
filter: {
|
||||
id
|
||||
}
|
||||
}, { dontCollect: true, forUpdate: true });
|
||||
const { type, shipOrder$ship } = ship;
|
||||
const wpPay = shipOrder$ship?.map((shipOrder) => shipOrder?.order?.pay$order).flat();
|
||||
if (type === 'virtual' || (type === 'pickup' && wpPay && wpPay.length > 0)) {
|
||||
await context.operate('ship', {
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'startReceiving',
|
||||
data: {
|
||||
},
|
||||
filter: {
|
||||
id,
|
||||
}
|
||||
}, option);
|
||||
}
|
||||
},
|
||||
} as UpdateTriggerCrossTxn<EntityDict, 'ship', BRC>,
|
||||
];
|
||||
|
||||
export default triggers;
|
||||
Loading…
Reference in New Issue