SELECT IFNULL(SUM(loading_quantity),0) FROM logpm_distribution_loadscan_abnormal WHERE reservation_id = #{reservationId} AND delivery_list_id = #{deliveryId} AND warehouse_id = #{warehouseId}
(IF((SELECT sum(loaded_nub) FROM logpm_distribution_loadscaninvn WHERE reservation_id = #{reservationId} AND scan_state != 1 AND signfor_state = 2)is null,0,(SELECT sum(loaded_nub) FROM logpm_distribution_loadscaninvn WHERE reservation_id = #{reservationId} AND scan_state != 1 AND signfor_state = 2)))
SELECT (IF((SELECT sum(loaded_nub) FROM logpm_distribution_loadscan WHERE delivery_id = #{deliveryId} AND scan_state != 1 AND is_abnormal_loading != 2 AND signfor_state = 2) is null,0,(SELECT sum(loaded_nub) FROM logpm_distribution_loadscan WHERE delivery_id = #{deliveryId} AND scan_state != 1 AND is_abnormal_loading != 2 AND signfor_state = 2)))
SELECT (IF((SELECT sum(loaded_nub) FROM logpm_distribution_loadscan WHERE delivery_id = #{deliveryId} AND scan_status != 1 AND is_abnormal_loading != 2 AND signfor_state = 2) is null,0,(SELECT sum(loaded_nub) FROM logpm_distribution_loadscan WHERE delivery_id = #{deliveryId} AND scan_status != 1 AND is_abnormal_loading != 2 AND signfor_state = 2)))
+
(IF((SELECT sum(loaded_nub) FROM logpm_distribution_loadscaninvn WHERE delivery_id = #{deliveryId} AND scan_state != 1 AND signfor_state = 2)is null,0,(SELECT sum(loaded_nub) FROM logpm_distribution_loadscaninvn WHERE delivery_id = #{deliveryId} AND scan_state != 1 AND signfor_state = 2)))
(IF((SELECT sum(loaded_nub) FROM logpm_distribution_loadscaninvn WHERE delivery_id = #{deliveryId} AND scan_status != 1 AND signfor_state = 2)is null,0,(SELECT sum(loaded_nub) FROM logpm_distribution_loadscaninvn WHERE delivery_id = #{deliveryId} AND scan_status != 1 AND signfor_state = 2)))
SELECT (IF((SELECT sum(loaded_nub) FROM logpm_distribution_loadscan WHERE delivery_id = #{deliveryId} AND scan_state != 1 AND is_abnormal_loading != 2 AND signfor_state = 2) is null,0,(SELECT sum(loaded_nub) FROM logpm_distribution_loadscan WHERE delivery_id = #{deliveryId} AND scan_state != 1 )))
<iftest="param.trainNumber != null and param.trainNumber != ''">
AND lddl.train_number LIKE CONCAT('%', #{param.trainNumber}, '%')
AND lddl.train_number LIKE CONCAT('%', #{param.trainNumber}, '%')
</if>
AND DATE_FORMAT( lddl.task_time, '%y%m%d' ) BETWEEN DATE_FORMAT( #{param.taskTime_start}, '%y%m%d' ) AND DATE_FORMAT( #{param.taskTime_end}, '%y%m%d' )
AND DATE_FORMAT( lddl.task_time, '%y%m%d' ) BETWEEN DATE_FORMAT( #{param.taskTime_start}, '%y%m%d' ) AND
DATE_FORMAT( #{param.taskTime_end}, '%y%m%d' )
AND lddl.warehouse_id = #{param.warehouseId}
</select>
<selectid="selectNewAppDistributionDetail"
@ -2045,7 +2055,8 @@
delivery_id = lddl.id
AND is_deleted = 0
AND scan_status != 1
) + ( SELECT IFNUll( sum( loaded_nub ), 0 ) FROM logpm_distribution_loadscaninvn WHERE delivery_id = lddl.id AND is_deleted = 0 AND scan_status != 1 )
) + ( SELECT IFNUll( sum( loaded_nub ), 0 ) FROM logpm_distribution_loadscaninvn WHERE delivery_id = lddl.id AND
is_deleted = 0 AND scan_status != 1 )
) AS loadingNumber,
((
SELECT
@ -2057,7 +2068,8 @@
AND is_deleted = 0
AND scan_status != 1
AND signfor_state = 2
) + ( SELECT IFNUll( sum( loaded_nub ), 0 ) FROM logpm_distribution_loadscaninvn WHERE delivery_id = lddl.id AND is_deleted = 0 AND scan_status != 1 AND signfor_state = 2 )
) + ( SELECT IFNUll( sum( loaded_nub ), 0 ) FROM logpm_distribution_loadscaninvn WHERE delivery_id = lddl.id AND
is_deleted = 0 AND scan_status != 1 AND signfor_state = 2 )
) AS signforNumber,
CASE lddl.delivery_status
WHEN '1' THEN '待配送'
@ -2085,16 +2097,16 @@
LEFT JOIN logpm_distribution_delivery_self ldds ON lddl.id = ldds.delivery_id
IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND is_deleted = 0 AND scan_status != 1 ), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = 0 ), 0 ) AS loadingQuantity,
IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND is_deleted = 0 AND scan_status != 1 AND signfor_state = 2), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = 0 AND signfor_state = 2 ), 0 ) AS signforQuantity,
( SELECT IFNULL( GROUP_CONCAT( stockup_area ), '无备货区' ) FROM logpm_distribution_stock WHERE reservation_id = ldr.id AND is_deleted = 0 ) AS stockupArea,
IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND
is_deleted = 0 AND scan_status != 1 ), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM
logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted =
0 ), 0 ) AS loadingQuantity,
IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND
is_deleted = 0 AND scan_status != 1 AND signfor_state = 2), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM
logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted =
0 AND signfor_state = 2 ), 0 ) AS signforQuantity,
( SELECT IFNULL( GROUP_CONCAT( stockup_area ), '无备货区' ) FROM logpm_distribution_stock WHERE reservation_id =
IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND is_deleted = 0 AND scan_status != 1 ), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = 0 ), 0 ) AS loadingQuantity,
IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND is_deleted = 0 AND scan_status != 1 AND signfor_state = 2), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = 0 AND signfor_state = 2 ), 0 ) AS signforQuantity,
( SELECT IFNULL( GROUP_CONCAT( stockup_area ), '无备货区' ) FROM logpm_distribution_stock WHERE reservation_id = ldr.id AND is_deleted = 0 ) AS stockupArea,
IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND
is_deleted = 0 AND scan_status != 1 ), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM
logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted =
0 ), 0 ) AS loadingQuantity,
IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND
is_deleted = 0 AND scan_status != 1 AND signfor_state = 2), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM
logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted =
0 AND signfor_state = 2 ), 0 ) AS signforQuantity,
( SELECT IFNULL( GROUP_CONCAT( stockup_area ), '无备货区' ) FROM logpm_distribution_stock WHERE reservation_id =