@ -220,12 +220,16 @@
</select>
<select id= "findDeliveryTotal" resultType= "com.logpm.report.vo.indexCount.IndexDeliveryDataVO" >
SELECT
warehouse_name,
warehouse_id,
type AS type,
count( 1 ) AS totalNum
FROM
logpm_distribution_delivery_list
<where >
is_deleted = 0 AND type IS NOT NULL
is_deleted = 0
AND type IS NOT NULL
AND kind = 1
<if test= "param.warehouseIds != null" >
and warehouse_id in
<foreach collection= "param.warehouseIds" item= "item" open= "(" separator= "," close= ")" >
@ -234,10 +238,12 @@
</if>
</where>
GROUP BY
type
warehouse_id, type
</select>
<select id= "findBillLadingTotal" resultType= "com.logpm.report.vo.indexCount.IndexDeliveryDataVO" >
SELECT
warehouse_name,
warehouse_id,
3 AS type,
count( 1 ) AS totalNum
FROM
@ -251,23 +257,22 @@
</foreach>
</if>
</where>
GROUP BY
warehouse_id
</select>
<select id= "findDeLiveryTotalNum" resultType= "java.lang.Integer" >
SELECT
sum( reservation_num + reservation_stock_list_num ) AS num
IFNULL( sum( ldr. reservation_num + ldr. reservation_stock_list_num ),0 ) AS num
FROM
logpm_distribution_reservation
logpm_distribution_reservation AS ldr
LEFT JOIN logpm_distribution_signfor AS lds ON lds.reservation_id = ldr.id AND lds.is_deleted = 0
LEFT JOIN logpm_distribution_delivery_list AS lddl ON lds.delivery_id = lddl.id AND lddl.is_deleted = 0
<where >
reservation_status != 40
AND is_deleted = 0
AND delivery_type = #{type}
<if test= "param.warehouseIds != null" >
AND warehouse_id IN
<foreach collection= "param.warehouseIds" item= "item" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
ldr.reservation_status != 40
AND ldr.is_deleted = 0
AND ldr.delivery_type = #{type}
AND lddl.kind = #{kind}
AND ldr.warehouse_id = #{warehouseId}
</where>
</select>
@ -276,20 +281,16 @@
IFNULL(sum( ldpl.weight ),0) AS num
FROM
logpm_distribution_reservation AS ldr
LEFT JOIN logpm_distribution_reservation_package AS ldrp ON ldr.id = ldrp.reservation_id
LEFT JOIN logpm_distribution_reservation_package AS ldrp ON ldr.id = ldrp.reservation_id AND ldrp.packet_bar_status != 2
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldpl.id = ldrp.parce_list_id
LEFT JOIN logpm_distribution_signfor AS lds ON lds.reservation_id = ldr.id AND lds.is_deleted = 0
LEFT JOIN logpm_distribution_delivery_list AS lddl ON lds.delivery_id = lddl.id AND lddl.is_deleted = 0
<where >
ldr.reservation_status != 40
AND ldr.is_deleted = 0
AND ldrp.packet_bar_status != 2
AND ldr.delivery_type = #{type}
<if test= "param.warehouseIds != null" >
AND ldr.warehouse_id IN
<foreach collection= "param.warehouseIds" item= "item" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
AND lddl.kind = #{kind}
AND ldr.warehouse_id = #{warehouseId}
</where>
</select>
<select id= "findDeliveryTotalVolume" resultType= "java.math.BigDecimal" >
@ -297,41 +298,31 @@
IFNULL(sum( ldpl.volume ),0) AS num
FROM
logpm_distribution_reservation AS ldr
LEFT JOIN logpm_distribution_reservation_package AS ldrp ON ldr.id = ldrp.reservation_id
LEFT JOIN logpm_distribution_reservation_package AS ldrp ON ldr.id = ldrp.reservation_id AND ldrp.packet_bar_status != 2
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldpl.id = ldrp.parce_list_id
LEFT JOIN logpm_distribution_signfor AS lds ON lds.reservation_id = ldr.id AND lds.is_deleted = 0
LEFT JOIN logpm_distribution_delivery_list AS lddl ON lds.delivery_id = lddl.id AND lddl.is_deleted = 0
<where >
ldr.reservation_status != 40
AND ldr.is_deleted = 0
AND ldrp.packet_bar_status != 2
AND ldr.delivery_type = #{type}
<if test= "param.warehouseIds != null" >
AND ldr.warehouse_id IN
<foreach collection= "param.warehouseIds" item= "item" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
AND lddl.kind = #{kind}
AND ldr.warehouse_id = #{warehouseId}
</where>
</select>
<select id= "findDeLiveryTotalRoadNum" resultType= "java.lang.Integer" >
SELECT
IFNULL(sum( ldl.package_nub ),0) AS num
SUM((ldr.reservation_num + ldr.reservation_stock_list_num) - (lds.loaded_number+lds.loadedin_number))
FROM
logpm_distribution_reservation AS ldr
LEFT JOIN logpm_distribution_reservation_package AS ldrp ON ldr.id = ldrp.reservation_id
LEFT JOIN logpm_distribution_loadscan AS ldl ON ldl.package_id = ldrp.parce_list_id
LEFT JOIN logpm_distribution_signfor AS lds ON lds.reservation_id = ldr.id AND lds.is_deleted = 0
LEFT JOIN logpm_distribution_delivery_list AS lddl ON lds.delivery_id = lddl.id AND lddl.is_deleted = 0
<where >
ldr.reservation_status != 40
AND ldr.is_deleted = 0
AND ldrp.packet_bar_status != 2
AND ldl.signfor_state = 1
AND ldl.is_deleted = 0
AND ldr.delivery_type = #{type}
<if test= "param.warehouseIds != null" >
AND ldr.warehouse_id IN
<foreach collection= "param.warehouseIds" item= "item" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
AND lddl.kind = 1
AND ldr.warehouse_id = #{warehouseId}
</where>
</select>
<select id= "findBillLadingTotalNum" resultType= "java.lang.Integer" >
@ -339,17 +330,11 @@
count(1) AS num
FROM
logpm_distrilbution_bill_package AS ldbp
LEFT JOIN logpm_distrilbution_bill_lading AS ldbl ON ldbp.bill_lading_id = ldbl.id
LEFT JOIN logpm_distrilbution_bill_lading AS ldbl ON ldbp.bill_lading_id = ldbl.id AND ldbl.is_deleted = 0
<where >
ldbp.packet_bar_status != 2
AND ldbp.is_deleted = 0
AND ldbl.is_deleted = 0
<if test= "param.warehouseIds != null" >
AND ldbl.warehouse_id IN
<foreach collection= "param.warehouseIds" item= "item" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
AND ldbl.warehouse_id = #{warehouseId}
</where>
</select>
<select id= "findBillLadingTotalWeight" resultType= "java.math.BigDecimal" >
@ -357,18 +342,12 @@
IFNULL(sum(ldpl.weight),0) AS weight
FROM
logpm_distrilbution_bill_package AS ldbp
LEFT JOIN logpm_distrilbution_bill_lading AS ldbl ON ldbp.bill_lading_id = ldbl.id
LEFT JOIN logpm_distrilbution_bill_lading AS ldbl ON ldbp.bill_lading_id = ldbl.id AND ldbl.is_deleted = 0
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldpl.id = ldbp.parce_list_id
<where >
ldbp.packet_bar_status != 2
AND ldbp.is_deleted = 0
AND ldbl.is_deleted = 0
<if test= "param.warehouseIds != null" >
AND ldbl.warehouse_id IN
<foreach collection= "param.warehouseIds" item= "item" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
AND ldbl.warehouse_id = #{warehouseId}
</where>
</select>
<select id= "findBillLadingTotalVolume" resultType= "java.math.BigDecimal" >
@ -376,18 +355,12 @@
IFNULL(sum(ldpl.volume),0) AS volume
FROM
logpm_distrilbution_bill_package AS ldbp
LEFT JOIN logpm_distrilbution_bill_lading AS ldbl ON ldbp.bill_lading_id = ldbl.id
LEFT JOIN logpm_distrilbution_bill_lading AS ldbl ON ldbp.bill_lading_id = ldbl.id AND ldbl.is_deleted = 0
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldpl.id = ldbp.parce_list_id
<where >
ldbp.packet_bar_status != 2
AND ldbp.is_deleted = 0
AND ldbl.is_deleted = 0
<if test= "param.warehouseIds != null" >
AND ldbl.warehouse_id IN
<foreach collection= "param.warehouseIds" item= "item" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
AND ldbl.warehouse_id = #{warehouseId}
</where>
</select>
<select id= "findTripartiteTotalByMerchant" resultType= "com.logpm.report.vo.indexCount.IndexDeliveryDataVO" >
@ -1021,6 +994,42 @@
</foreach>
group by warehouse_id
</select>
<select id= "findBillLadingRoadTotalNum" resultType= "java.lang.Integer" >
SELECT
COUNT(1)
FROM
logpm_distrilbution_bill_lading AS ldbl
LEFT JOIN logpm_distrilbution_bill_package AS ldbp ON ldbl.id = ldbp.bill_lading_id AND ldbp.packet_bar_status != 2
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldpl.id = ldbp.parce_list_id AND ldpl.order_package_status != 70
LEFT JOIN logpm_dis_stock_list_detail AS ldsld ON ldsld.reservation_id = ldbl.id AND ldsld.stock_signfo_status != 20 AND ldsld.stock_package_status != 2
WHERE
ldbl.is_deleted = 0
AND ldbl.warehouse_id = #{warehouseId}
GROUP BY
ldbl.warehouse_id
</select>
<select id= "findTripartiteDeliveryTotal" resultType= "com.logpm.report.vo.indexCount.IndexDeliveryDataVO" >
SELECT
warehouse_name,
warehouse_id,
type AS type,
count( 1 ) AS totalNum
FROM
logpm_distribution_delivery_list
<where >
is_deleted = 0
AND type IS NOT NULL
AND kind = 2
<if test= "param.warehouseIds != null" >
and warehouse_id in
<foreach collection= "param.warehouseIds" item= "item" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
</where>
GROUP BY
warehouse_id,type
</select>
</mapper>