|
|
|
@ -288,18 +288,17 @@
|
|
|
|
|
when ifnull(sum(t.num), 0) = 0 then 0 |
|
|
|
|
else round((ifnull(sum(tt.hgNum), 0)*100) / ifnull(sum(t.num), 0),2) end, '%') as signOnTimeRate |
|
|
|
|
from (select lww.business_line, t.warehouse, t.brand_name, |
|
|
|
|
case when ifnull(lbc.type_service,1) = 1 then '商配' |
|
|
|
|
when ifnull(lbc.type_service,1) = 2 then '市配' |
|
|
|
|
when ifnull(lbc.type_service,1) = 3 then '自提' |
|
|
|
|
when ifnull(lbc.type_service,1) = 4 then '三方中转' end |
|
|
|
|
type_service |
|
|
|
|
, count(distinct t.order_code) orderNum, sum(t.quantity) num |
|
|
|
|
case |
|
|
|
|
when ifnull(ldsa.type_service,'1') = '1' then '商配' |
|
|
|
|
when ifnull(ldsa.type_service,'1') = '2' then '市配' |
|
|
|
|
when ifnull(ldsa.type_service, '1') = '3' then '自提' |
|
|
|
|
when ifnull(ldsa.type_service, '1') = '4' then '三方中转' end as type_service, |
|
|
|
|
count(distinct t.order_code) orderNum, sum(t.quantity) num |
|
|
|
|
from logpm_distribution_parcel_list t |
|
|
|
|
left join logpm_warehouse_waybill lww1 on lww1.waybill_no = t.waybill_number and lww1.is_deleted = 0 |
|
|
|
|
left join logpm_basicdata_client lbc on lbc.client_name = lww1.consignee and lbc.is_deleted = 0 |
|
|
|
|
join logpm_distribution_stock_article ldsa on ldsa.order_code = t.order_code and ldsa.is_deleted = 0 |
|
|
|
|
left join logpm_warehouse_warehouse lww on lww.id = t.warehouse_id |
|
|
|
|
where t.warehouse_entry_time_end >= #{query.startCreateTime} and t.warehouse_entry_time_end <= #{query.endCreateTime} |
|
|
|
|
and t.is_transfer = 0 and (lbc.type_service != 2 or lbc.type_service is null) |
|
|
|
|
and t.is_transfer = 0 and ldsa.type_service != '2' |
|
|
|
|
<if test="query.businessLineRange != null and query.businessLineRange != ''"> |
|
|
|
|
and lww.business_line in |
|
|
|
|
<foreach collection="query.businessLineRange.split(',')" item="businessLine" open="(" separator="," close=")"> |
|
|
|
@ -325,7 +324,7 @@
|
|
|
|
|
</foreach> |
|
|
|
|
</if> |
|
|
|
|
<if test="query.typeServiceRange != null and query.typeServiceRange != ''"> |
|
|
|
|
and ifnull(lbc.type_service,'1') in |
|
|
|
|
and ifnull(ldsa.type_service,'1') in |
|
|
|
|
<foreach collection="query.typeServiceRange.split(',')" item="typeService" open="(" separator="," close=")"> |
|
|
|
|
<if test="typeService == '商配'.toString() "> |
|
|
|
|
'1' |
|
|
|
@ -341,14 +340,11 @@
|
|
|
|
|
</if> |
|
|
|
|
</foreach> |
|
|
|
|
</if> |
|
|
|
|
group by lww.business_line, t.warehouse, t.brand_name,ifnull(lbc.type_service,1)) t |
|
|
|
|
group by lww.business_line, t.warehouse, t.brand_name,ifnull(ldsa.type_service,1)) t |
|
|
|
|
left join (select t.business_unit, |
|
|
|
|
t.warehouse_name, |
|
|
|
|
t.brand_name, case when ifnull(lbc.type_service,1) = 1 then '商配' |
|
|
|
|
when ifnull(lbc.type_service,1) = 2 then '市配' |
|
|
|
|
when ifnull(lbc.type_service,1) = 3 then '自提' |
|
|
|
|
when ifnull(lbc.type_service,1) = 4 then '三方中转' end |
|
|
|
|
type_service, |
|
|
|
|
t.brand_name, |
|
|
|
|
t.custom_type as type_service, |
|
|
|
|
sum(t.sign_num) signNum, |
|
|
|
|
sum(case when t.sign_type = '文员批量签收' then t.sign_num else 0 end) batchNum, |
|
|
|
|
sum(case |
|
|
|
@ -356,10 +352,8 @@
|
|
|
|
|
then 1 |
|
|
|
|
else 0 end) hgNum |
|
|
|
|
from logpm_quality_deliver t |
|
|
|
|
left join logpm_warehouse_waybill lww1 on lww1.waybill_no = t.waybill_number and lww1.is_deleted = 0 |
|
|
|
|
left join logpm_basicdata_client lbc on lbc.client_name = lww1.consignee and lbc.is_deleted = 0 |
|
|
|
|
where t.end_warehouse_in_time >= #{query.startCreateTime} and t.end_warehouse_in_time <= #{query.endCreateTime} |
|
|
|
|
and t.sign_num is not null and (lbc.type_service != 2 or lbc.type_service is null) |
|
|
|
|
and t.sign_num is not null and t.custom_type != '市配' |
|
|
|
|
<if test="query.businessLineRange != null and query.businessLineRange != ''"> |
|
|
|
|
and t.business_unit in |
|
|
|
|
<foreach collection="query.businessLineRange.split(',')" item="businessLine" open="(" separator="," close=")"> |
|
|
|
@ -385,23 +379,12 @@
|
|
|
|
|
</foreach> |
|
|
|
|
</if> |
|
|
|
|
<if test="query.typeServiceRange != null and query.typeServiceRange != ''"> |
|
|
|
|
and ifnull(lbc.type_service,'1') in |
|
|
|
|
and t.custom_type in |
|
|
|
|
<foreach collection="query.typeServiceRange.split(',')" item="typeService" open="(" separator="," close=")"> |
|
|
|
|
<if test="typeService == '商配'.toString() "> |
|
|
|
|
'1' |
|
|
|
|
</if> |
|
|
|
|
<if test="typeService == '市配'.toString() "> |
|
|
|
|
'2' |
|
|
|
|
</if> |
|
|
|
|
<if test="typeService == '自提'.toString() "> |
|
|
|
|
'3' |
|
|
|
|
</if> |
|
|
|
|
<if test="typeService == '三方中转'.toString() "> |
|
|
|
|
'4' |
|
|
|
|
</if> |
|
|
|
|
#{typeService} |
|
|
|
|
</foreach> |
|
|
|
|
</if> |
|
|
|
|
group by t.business_unit, t.warehouse_name, t.brand_name,ifnull(lbc.type_service,1)) tt |
|
|
|
|
group by t.business_unit, t.warehouse_name, t.brand_name,t.custom_type) tt |
|
|
|
|
on t.business_line = tt.business_unit and t.warehouse = tt.warehouse_name and |
|
|
|
|
t.brand_name = tt.brand_name and t.type_service = tt.type_service |
|
|
|
|
<if test="(query.businessLineRange != null and query.businessLineRange != '') |
|
|
|
|