(SELECT sum(ldl.package_nub) from logpm_distribution_loadscan ldl WHERE ldl.reservation_id = lds.reservation_id and ldl.scan_status !=1) loadedNumber,
COALESCE((SELECT sum(ldl.received_quantity) from logpm_distribution_loadscan ldl WHERE ldl.reservation_id = lds.reservation_id and lds.driver_signing ='2'), 0) receivedQuantity
FROM
logpm_distribution_signfor
logpm_distribution_signfor lds
<where>
is_deleted = 0
<iftest="param.number != null and param.number!=''">
and number like concat('%',#{param.number},'%')
</if>
lds.is_deleted = 0
<iftest="param.shoppingName != null and param.shoppingName!=''">
and shopping_name like concat('%',#{param.shoppingName},'%')
and lds.shopping_name like concat('%',#{param.shoppingName},'%')
</if>
<iftest="param.deliveryTime!=null and param.deliveryTime!=''">
and date_format(delivery_time,'%y%m%d%') = date_format(#{param.deliveryTime},'%y%m%d%')
and date_format(lds.delivery_time,'%y%m%d%') = date_format(#{param.deliveryTime},'%y%m%d%')
</if>
<iftest="param.signingTime!=null and param.signingTime!=''">
and date_format(signing_time,'%y%m%d%') = date_format(#{param.signingTime},'%y%m%d%')
and date_format(lds.signing_time,'%y%m%d%') = date_format(#{param.signingTime},'%y%m%d%')
</if>
<iftest="param.sjsigningTime!=null and param.sjsigningTime!=''">
and date_format(sjsigning_time,'%y%m%d%') = date_format(#{param.sjsigningTime},'%y%m%d%')
and date_format(lds.sjsigning_time,'%y%m%d%') = date_format(#{param.sjsigningTime},'%y%m%d%')
</if>
<iftest="param.orderId != null and param.orderId!=''">
and order_id like concat('%',#{param.orderId},'%')
<iftest="param.stockArticleId != null and param.stockArticleId!=''">
and lds.stock_article_id like concat('%',#{param.stockArticleId},'%')
</if>
<iftest="param.consigneeName != null and param.consigneeName!=''">
and consignee_name like concat('%',#{param.consigneeName},'%')
<iftest="param.consignee != null and param.consignee!=''">
and lds.consignee like concat('%',#{param.consignee},'%')
</if>
<iftest="param.deliveryType != null and param.deliveryType!=''">
and delivery_type = #{param.deliveryType}
and lds.delivery_type = #{param.deliveryType}
</if>
<iftest="param.signingStatus != null and param.signingStatus!=''">
and signing_status = #{param.signingStatus}
</if>
<iftest="param.orderSource != null and param.orderSource!=''">
and order_source = #{param.orderSource}
and lds.order_source = #{param.orderSource}
</if>
<iftest="param.deliveryPhone != null and param.deliveryPhone!=''">
and delivery_phone = #{param.deliveryPhone}
and lds.delivery_phone like concat('%',#{param.deliveryPhone},'%')
</if>
<iftest="param.trainNumber != null and param.trainNumber!=''">
and train_number like concat('%',#{param.trainNumber},'%')
and lds.train_number like concat('%',#{param.trainNumber},'%')
</if>
<iftest="param.deliveryDriverName != null and param.deliveryDriverName!=''">
and delivery_driver_name like concat('%',#{param.deliveryDriverName},'%')
and lds.delivery_driver_name like concat('%',#{param.deliveryDriverName},'%')
</if>
<iftest="param.deliveryAddress != null and param.deliveryAddress!=''">
and delivery_address like concat('%',#{param.deliveryAddress},'%')
and lds.delivery_address like concat('%',#{param.deliveryAddress},'%')
</if>
<iftest="param.driverSigning != null and param.driverSigning!=''">
and driver_signing = #{param.driverSigning}
and lds.driver_signing = #{param.driverSigning}
</if>
</where>
</select>
@ -266,8 +334,8 @@
<iftest="param.orderId != null and param.orderId!=''">
and order_id like concat('%',#{param.orderId},'%')
</if>
<iftest="param.consigneeName != null and param.consigneeName!=''">
and consignee_name like concat('%',#{param.consigneeName},'%')
<iftest="param.consignee != null and param.consignee!=''">
and consignee like concat('%',#{param.consignee},'%')
</if>
<iftest="param.deliveryType != null and param.deliveryType!=''">
and delivery_type = #{param.deliveryType}
@ -314,8 +382,8 @@
<iftest="param.orderId != null and param.orderId!=''">
and order_id like concat('%',#{param.orderId},'%')
</if>
<iftest="param.consigneeName != null and param.consigneeName!=''">
and consignee_name like concat('%',#{param.consigneeName},'%')
<iftest="param.consignee != null and param.consignee!=''">
and consignee like concat('%',#{param.consignee},'%')
</if>
<iftest="param.deliveryType != null and param.deliveryType!=''">