feat(gao recycle): support quick fulfillment for recycle order
This commit is contained in:
@@ -105,6 +105,10 @@
|
||||
<select id="selectQuickFulfillmentSourceRows" resultType="com.imyeyu.api.modules.gao.vo.GaoQuickFulfillmentSourceRow">
|
||||
SELECT o.`id` AS `salesOrderId`, o.`order_no` AS `orderNo`, o.`order_type` AS `orderType`,
|
||||
o.`payment_status` AS `paymentStatus`,
|
||||
o.`recycle_required_quantity` AS `recycleRequiredQuantity`,
|
||||
(SELECT COALESCE(SUM(rp.`quantity`), 0) FROM `gao_recycle_payment` rp WHERE rp.`order_id` = o.`id` AND rp.`status` = 'VERIFIED' AND rp.`source_payment_id` IS NULL) AS `recycleVerifiedQuantity`,
|
||||
(SELECT e.`recycle_name_snapshot` FROM `gao_recycle_exchange` e WHERE e.`sales_order_id` = o.`id` LIMIT 1) AS `recycleItemName`,
|
||||
(SELECT e.`recycle_unit_snapshot` FROM `gao_recycle_exchange` e WHERE e.`sales_order_id` = o.`id` LIMIT 1) AS `recycleUnit`,
|
||||
o.`created_at` AS `orderCreatedAt`,
|
||||
(SELECT cp.`package_name_snapshot` FROM `gao_customer_package` cp
|
||||
WHERE cp.`sales_order_id` = o.`id` AND cp.`deleted_at` IS NULL LIMIT 1) AS `packageName`,
|
||||
@@ -121,9 +125,12 @@
|
||||
INNER JOIN `gao_product` p ON p.`id` = s.`product_id` AND p.`deleted_at` IS NULL
|
||||
WHERE i.`deleted_at` IS NULL AND o.`store_id` = #{storeId} AND o.`customer_id` = #{customerId}
|
||||
AND o.`status` <> 'CANCELLED'
|
||||
AND (#{allowUnpaid} OR o.`sale_amount` = 0 OR o.`paid_amount` = o.`sale_amount`)
|
||||
AND ((o.`order_type` = 'PACKAGE' AND i.`item_type` = 'PACKAGE_ENTITLEMENT')
|
||||
OR (o.`order_type` = 'DIRECT_PRODUCT' AND i.`item_type` = 'DIRECT_PRODUCT'))
|
||||
AND ((o.`order_type` = 'RECYCLE' AND i.`item_type` = 'RECYCLE_ENTITLEMENT'
|
||||
AND (#{allowUnsettledRecycle} OR (o.`recycle_required_quantity` IS NOT NULL AND
|
||||
(SELECT COALESCE(SUM(rp.`quantity`), 0) FROM `gao_recycle_payment` rp WHERE rp.`order_id` = o.`id` AND rp.`status` = 'VERIFIED' AND rp.`source_payment_id` IS NULL) >= o.`recycle_required_quantity`)))
|
||||
OR ((#{allowUnpaid} OR o.`sale_amount` = 0 OR o.`paid_amount` = o.`sale_amount`)
|
||||
AND ((o.`order_type` = 'PACKAGE' AND i.`item_type` = 'PACKAGE_ENTITLEMENT')
|
||||
OR (o.`order_type` = 'DIRECT_PRODUCT' AND i.`item_type` = 'DIRECT_PRODUCT'))))
|
||||
AND COALESCE(i.`base_quantity`, 0) - COALESCE(i.`reserved_base_quantity`, 0) - COALESCE(i.`fulfilled_base_quantity`, 0) > 0
|
||||
<if test="skuIdList != null and skuIdList.size() > 0">
|
||||
AND i.`sku_id` IN
|
||||
|
||||
Reference in New Issue
Block a user