(ldsa.incoming_num - if((select num from order_use_num where stock_article_id=ldsa.id) is null,0,(select num from order_use_num where stock_article_id=ldsa.id)))AS handQuantity,
LEFT JOIN logpm_warehouse_updown_goods lwug on lwug.association_id = ldpl.id
LEFT JOIN order_use_num AS oun ON ldsa.id = oun.stock_article_id
<where>
ldsa.order_status in ('10','20','30','70') and ldsa.reservation_status in ('10','20') AND (ldsa.incoming_num - oun.num) > 0
ldsa.order_status in ('10','20','30','70') AND
(ldsa.incoming_num - if((select num from order_use_num where stock_article_id=ldsa.id) is null,0,(select num from order_use_num where stock_article_id=ldsa.id)))>0
<iftest="par.warehouseId != null and par.warehouseId != '' ">