AND date_format(ldpl.create_time ,'%y%m%d%') = date_format(#{param.earliestWarehouseEntryTime},'%y%m%d%')
</if>
<iftest="param.warehouseEntryTime != null ">
AND date_format(ldpl.create_time ,'%y%m%d%') = date_format(#{param.warehouseEntryTime},'%y%m%d%')
</if>
<iftest="param.scanSigningTime != null ">
AND date_format(ldl.signing_time ,'%y%m%d%') = date_format(#{param.scanSigningTime},'%y%m%d%')
</if>
<iftest="param.warehouseEntryTimeStart != null and param.warehouseEntryTimeEnd != null ">
AND date_format(ldpl.create_time ,'%y%m%d%') BETWEEN date_format(#{param.warehouseEntryTimeStart},'%y%m%d%') AND date_format(#{param.warehouseEntryTimeEnd},'%y%m%d%')
</if>
<iftest="param.scanSigningTimeStart != null and param.scanSigningTimeEnd != null ">
AND date_format(ldl.signing_time ,'%y%m%d%') BETWEEN date_format(#{param.scanSigningTimeStart},'%y%m%d%') AND date_format(#{param.scanSigningTimeEnd},'%y%m%d%')
</if>
</where>
GROUP BY
ldl.order_id,ldl.reservation_id
UNION ALL
SELECT
ldsa.id AS id,
ldsa.waybill_number AS waybillNumber,
ldsa.service_number AS serviceNumber,
ldsa.order_code AS orderCode,
ldsa.mall_name AS mallName,
ldsa.warehouse AS warehouseName,
ldsa.consignee_unit AS consigneeUnit,
ldsa.consignee_person AS consigneePerson,
ldsa.total_number AS totalNumber,
ldsa.hand_quantity AS handQuantity,
ldsa.brand AS brand,
ldsa.delivery_quantity as deliveryNumber,
ldsa.signin_quantity AS signForNumber,
IFNULL((SELECT sum(stock_quantity) FROM logpm_distribution_stock WHERE stock_article = ldsa.id),0) AS
stockUpNumber,
ldsa.create_time AS createTime,
ldsa.create_user AS createUser,
CASE
ldsa.order_status
WHEN 70 THEN
'部分签收'
WHEN 80 THEN
'已签收' ELSE '未知'
END AS orderStatusName,
CASE
ldsa.is_zero
WHEN 0 THEN
'否'
WHEN 1 THEN
'是' ELSE '未知'
END AS isZeroName,
CASE
ldsa.reservation_status
WHEN 10 THEN
'待预约'
WHEN 20 THEN
'部分预约'
WHEN 30 THEN
'已预约'
END AS orderReservationStatusName,
CASE
ldsa.is_zero
WHEN 0 THEN
IF
( ldsa.total_number = ( SELECT sum( quantity ) FROM logpm_distribution_parcel_list WHERE stock_article_id =
ldsa.id ), '是', '否' )
WHEN 1 THEN
IF
( ldsa.total_number = ( SELECT sum( quantity ) FROM logpm_distribution_parcel_number WHERE stock_article_id =
AND date_format(ldpl.create_time ,'%y%m%d%') = date_format(#{param.earliestWarehouseEntryTime},'%y%m%d%')
</if>
<iftest="param.warehouseEntryTime != null ">
AND date_format(ldpl.create_time ,'%y%m%d%') = date_format(#{param.warehouseEntryTime},'%y%m%d%')
</if>
<iftest="param.scanSigningTime != null ">
AND date_format(ldbls.create_time ,'%y%m%d%') = date_format(#{param.scanSigningTime},'%y%m%d%')
</if>
<iftest="param.warehouseEntryTimeStart != null and param.warehouseEntryTimeEnd != null ">
AND date_format(ldpl.create_time ,'%y%m%d%') BETWEEN date_format(#{param.warehouseEntryTimeStart},'%y%m%d%') AND date_format(#{param.warehouseEntryTimeEnd},'%y%m%d%')
</if>
<iftest="param.scanSigningTimeStart != null and param.scanSigningTimeEnd != null ">
AND date_format(ldbls.create_time ,'%y%m%d%') BETWEEN date_format(#{param.scanSigningTimeStart},'%y%m%d%') AND date_format(#{param.scanSigningTimeEnd},'%y%m%d%')