@ -7,6 +7,7 @@
lta.warehouse_id warehouseId,
lta.warehouse_name warehouseName,
lta.brand brand,
#{param.hoursTime} hoursTime,
count(lta.id) totalNum,
count(lta.id)-sum(if(lta.waybill_status='0' and lta.freeze_status = '1',1,0)) needOpenNum,
sum(if(lta.waybill_status='1',1,0)) hasOpenNum,
@ -62,6 +63,7 @@
lta.warehouse_id warehouseId,
lta.warehouse_name warehouseName,
lta.brand brand,
#{param.hoursTime} hoursTime,
count(lta.id) totalNum,
count(lta.id)-sum(if(lta.waybill_status='0' and lta.freeze_status = '1',1,0)) needOpenNum,
sum(if(lta.waybill_status='1',1,0)) hasOpenNum,
@ -119,6 +121,7 @@
lww.destination_warehouse_id destinationWarehouseId,
lww.destination_warehouse_name destinationWarehouseName,
lww.brand brand,
#{param.hoursTime} hoursTime,
count(lww.id) totalNum,
sum(if(lww.check_status=1,1,0)) hasCheckNum,
IFNULL(round(sum(if(lww.check_status=1,1,0))/count(lww.id)*100,2),'0.00') hasCheckRate,
@ -174,6 +177,7 @@
lww.destination_warehouse_id destinationWarehouseId,
lww.destination_warehouse_name destinationWarehouseName,
lww.brand brand,
#{param.hoursTime} hoursTime,
count(lww.id) totalNum,
sum(if(lww.check_status=1,1,0)) hasCheckNum,
IFNULL(concat(round(sum(if(lww.check_status=1,1,0))/count(lww.id)*100,2),'%'),'0.00%') hasCheckRate,
@ -232,9 +236,9 @@
count(lta.id) totalNum,
count(DISTINCT lta.waybill_id) waybillNum,
count(lta.waybill_id) openNum,
count(ltcls.id ) startNum,
count(lta.id)-count(ltcls.id ) noOutNum,
sum(if( ltcls.id is null and now() < = DATE_ADD( lta.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0)) noOutOverNum,
sum( IF(ltcls.id IS NOT NULL AND ltcll.start_date is not null,1,0) ) startNum,
count(lta.id)-sum( IF(ltcls.id IS NOT NULL AND ltcll.start_date is not null,1,0) ) noOutNum,
sum(if( ltcls.id is null and now() > DATE_ADD( lta.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0)) noOutOverNum,
sum(if(ltcll.start_date < = DATE_ADD( lta.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0)) onTimeNum,
IFNULL(round(sum(if(ltcll.start_date < = DATE_ADD( lta.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0))/count(lta.id)*100,2),'0.00') onTimeRate,
round(sum(TIMESTAMPDIFF(SECOND, lta.create_time, ltcll.start_date))/count(ltcls.id)/3600,1) avgTime
@ -292,9 +296,9 @@
count(lta.id) totalNum,
count(DISTINCT lta.waybill_id) waybillNum,
count(lta.waybill_id) openNum,
count(ltcls.id ) startNum,
count(lta.id)-count(ltcls.id ) noOutNum,
sum(if( ltcls.id is null and now() < = DATE_ADD( lta.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0)) noOutOverNum,
sum( IF(ltcls.id IS NOT NULL AND ltcll.start_date is not null,1,0) ) startNum,
count(lta.id)-sum( IF(ltcls.id IS NOT NULL AND ltcll.start_date is not null,1,0) ) noOutNum,
sum(if( ltcls.id is null and now() > DATE_ADD( lta.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0)) noOutOverNum,
sum(if(ltcll.start_date < = DATE_ADD( lta.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0)) onTimeNum,
IFNULL(concat(round(sum(if(ltcll.start_date < = DATE_ADD( lta.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0))/count(ltcls.id)*100,2),'%'),'0.00%') onTimeRate,
round(sum(TIMESTAMPDIFF(SECOND, lta.create_time, ltcll.start_date))/count(ltcls.id)/3600,1) avgTime
@ -567,12 +571,12 @@
ldpl.warehouse warehouseName,
ldpl.brand_name brand,
sum(ldpl.quantity) incomingNum,
count(ltcls.id) outNum,
sum(ldpl.quantity)-count(ltcls.id) noOutNum,
sum( if(ltcls.id is not null or ldpl.order_package_status != '20',1,0)) AS outNum,
sum( ldpl.quantity ) - sum( if(ltcls.id is not null or ldpl.order_package_status != '20',1,0)) AS noOutNum,
sum(if(ldpl.order_package_status='20' and now() > DATE_ADD( ldpl.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0 )) noOutOverNum,
sum(if(ltcll.start_date < DATE_ADD( ldpl.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0)) outOnTimeNum,
IFNULL(round(sum(if(ltcll.start_date < DATE_ADD( ldpl.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0))/count(ltcls.id )*100,2),'0.00') outOnTimeRate,
round(sum(TIMESTAMPDIFF(SECOND, ldpl.create_time, ltcll.start_date))/count(ltcls.id )/3600,1) avgTime
IFNULL(round(sum(if(ltcll.start_date < DATE_ADD( ldpl.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0))/sum( if(ltcls.id is not null or ldpl.order_package_status != '20',1,0) )*100,2),'0.00') outOnTimeRate,
round(sum(TIMESTAMPDIFF(SECOND, ldpl.create_time, ltcll.start_date))/sum( if(ltcls.id is not null or ldpl.order_package_status != '20',1,0) )/3600,1) avgTime
from logpm_distribution_parcel_list ldpl
left join logpm_warehouse_warehouse waw on waw.id = ldpl.warehouse_id
left join logpm_trunkline_cars_load_scan ltcls on ltcls.scan_code = ldpl.order_package_code and ltcls.warehouse_id = ldpl.warehouse_id and ltcls.type = 1
@ -636,12 +640,12 @@
ldpl.warehouse warehouseName,
ldpl.brand_name brand,
sum(ldpl.quantity) incomingNum,
count(ltcls.id) outNum,
sum(ldpl.quantity)-count(ltcls.id) noOutNum,
sum( if(ltcls.id is not null or ldpl.order_package_status != '20',1,0)) AS outNum,
sum( ldpl.quantity ) - sum( if(ltcls.id is not null or ldpl.order_package_status != '20',1,0)) AS noOutNum,
sum(if(ldpl.order_package_status='20' and now() > DATE_ADD( ldpl.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0 )) noOutOverNum,
sum(if(ltcll.start_date < = DATE_ADD( ldpl.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0)) outOnTimeNum,
IFNULL(concat( round(sum(if(ltcll.start_date < = DATE_ADD( ldpl.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0))/count(ltcls.id)*100,2),'%'),'0.00% ') outOnTimeRate,
round(sum(TIMESTAMPDIFF(SECOND, ldpl.create_time, ltcll.start_date))/count(ltcls.id )/3600,1) avgTime
sum(if(ltcll.start_date < DATE_ADD( ldpl.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0)) outOnTimeNum,
IFNULL(round(sum(if(ltcll.start_date < DATE_ADD( ldpl.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0))/sum( if(ltcls.id is not null or ldpl.order_package_status != '20',1,0))*100,2),'0.00 ') outOnTimeRate,
round(sum(TIMESTAMPDIFF(SECOND, ldpl.create_time, ltcll.start_date))/sum( if(ltcls.id is not null or ldpl.order_package_status != '20',1,0) )/3600,1) avgTime
from logpm_distribution_parcel_list ldpl
left join logpm_warehouse_warehouse waw on waw.id = ldpl.warehouse_id
left join logpm_trunkline_cars_load_scan ltcls on ltcls.scan_code = ldpl.order_package_code and ltcls.warehouse_id = ldpl.warehouse_id and ltcls.type = 1
@ -833,7 +837,7 @@
lww.destination_warehouse_id destinationWarehouseId,
lww.destination_warehouse_name destinationWarehouseName,
lww.brand brand,
IFNULL(lrat.hours_time,#{param.hoursTime}) hoursTime,
IFNULL(min( lrat.hours_time) ,#{param.hoursTime}) hoursTime,
count(DISTINCT ltad.waybill_id) waybillNum,
count(ltad.id) openNum,
IFNULL(sum(ldpl.quantity),0) arriveNum,
@ -911,7 +915,7 @@
lww.departure_warehouse_name departureWarehouseName,
lww.destination_warehouse_name destinationWarehouseName,
lww.brand brand,
IFNULL(lrat.hours_time,#{param.hoursTime}) hoursTime,
IFNULL(min( lrat.hours_time) ,#{param.hoursTime}) hoursTime,
count(DISTINCT ltad.waybill_id) waybillNum,
count(ltad.id) openNum,
IFNULL(sum(ldpl.quantity),0) arriveNum,
@ -1355,7 +1359,11 @@
lww.consignee consignee,
lww.departure_warehouse_name departureWarehouseName,
lww.destination_warehouse_name destinationWarehouseName,
min(lqd.delivery_type) serviceType,
IFNULL(CASE WHEN min( lqd.delivery_type )='商配' then '1'
when min( lqd.delivery_type )='市配' then '2'
when min( lqd.delivery_type )='自提' then '3'
when min( lqd.delivery_type )='三方中转' then '4'
end,min(lww.service_type)) serviceType,
GROUP_CONCAT(DISTINCT ltad.train_number) trainNumber,
GROUP_CONCAT(DISTINCT ltcls.load_code) loadingLoadCode,
GROUP_CONCAT(DISTINCT ltclsm.load_code) unloadLoadCode,
@ -1481,11 +1489,10 @@
lww.consignee consignee,
lww.departure_warehouse_name departureWarehouseName,
lww.destination_warehouse_name destinationWarehouseName,
CASE WHEN min(lqd.delivery_type)=1 THEN '商配'
WHEN min(lqd.delivery_type)=2 THEN '市配'
WHEN min(lqd.delivery_type)=3 THEN '自提'
WHEN min(lqd.delivery_type)=4 THEN '三方中转'
ELSE '未知' END serviceType,
IFNULL(min(lqd.delivery_type),CASE WHEN min(lww.service_type) = 1 then '商配'
when min(lww.service_type) = 2 then '市配'
when min(lww.service_type) = 3 then '自提'
when min(lww.service_type) = 4 then '三方中转' else '未知' end) serviceType,
GROUP_CONCAT(DISTINCT ltad.train_number) trainNumber,
GROUP_CONCAT(DISTINCT ltcls.load_code) loadingLoadCode,
GROUP_CONCAT(DISTINCT ltclsm.load_code) unloadLoadCode,
@ -1964,6 +1971,7 @@
lww.shipper_name shipperName,
lww.shipper_mobile shipperMobile,
lww.shipper_address shipperAddress,
lww.service_type serviceType,
lww.destination destination,
lww.complete_destination completeDestination,
lww.departure departure,
@ -2035,8 +2043,8 @@
count(lwwd.id) goodsTypeCount,
round(TIMESTAMPDIFF(SECOND, lww.create_time, lww.check_time)/3600,1) checkHours,
#{param.hoursTime} hoursTime,
case when round(TIMESTAMPDIFF(SECOND, lww.create_time, lww.check_time)/3600,1) < = #{param.hoursTime} then '0'
when round(TIMESTAMPDIFF(SECOND, lww.create_time, lww.check_time)/3600,1) > #{param.hoursTime} then '1'
case when round(TIMESTAMPDIFF(SECOND, lww.create_time, IFNULL( lww.check_time,NOW()) )/3600,1) < = #{param.hoursTime} then '0'
when round(TIMESTAMPDIFF(SECOND, lww.create_time, IFNULL( lww.check_time,NOW()) )/3600,1) > #{param.hoursTime} then '1'
else '未知'
end isOverTime
from logpm_warehouse_waybill lww
@ -2191,11 +2199,11 @@
<if test= "param.settlementStatus != null" >
and lww.settlement_status = #{param.settlementStatus}
</if>
<if test= "param.overTimeStatus != null and param.overTimeStatus == 0" >
and round(TIMESTAMPDIFF(SECOND, lww.create_time, lww.check_time)/3600,1) < = #{param.hoursTime}
<if test= "param.isOverTime != null and param.isOverTime == 0" >
and round(TIMESTAMPDIFF(SECOND, lww.create_time, IFNULL( lww.check_time,NOW()) )/3600,1) < = #{param.hoursTime}
</if>
<if test= "param.overTimeStatus != null and param.overTimeStatus == 1" >
and round(TIMESTAMPDIFF(SECOND, lww.create_time, lww.check_time)/3600,1) > #{param.hoursTime}
<if test= "param.isOverTime != null and param.isOverTime == 1" >
and round(TIMESTAMPDIFF(SECOND, lww.create_time, IFNULL( lww.check_time,NOW()) )/3600,1) > #{param.hoursTime}
</if>
<if test= "param.checkDetailType != null and param.checkDetailType == 2 " >
and lww.check_status=1
@ -2225,6 +2233,11 @@
lww.shipper_name shipperName,
lww.shipper_mobile shipperMobile,
lww.shipper_address shipperAddress,
case when lww.service_type='1' then '商配'
when lww.service_type='2' then '市配'
when lww.service_type='3' then '自提'
when lww.service_type='4' then '三方中转'
ELSE '未知' END serviceType,
lww.destination destination,
lww.complete_destination completeDestination,
lww.departure departure,
@ -2344,8 +2357,8 @@
count(lwwd.id) goodsTypeCount,
round(TIMESTAMPDIFF(SECOND, lww.create_time, lww.check_time)/3600,1) checkHours,
#{param.hoursTime} hoursTime,
case when round(TIMESTAMPDIFF(SECOND, lww.create_time, lww.check_time)/3600,1) < = #{param.hoursTime} then '未超时'
when round(TIMESTAMPDIFF(SECOND, lww.create_time, lww.check_time)/3600,1) > #{param.hoursTime} then '超时'
case when round(TIMESTAMPDIFF(SECOND, lww.create_time, IFNULL( lww.check_time,NOW()) )/3600,1) < = #{param.hoursTime} then '未超时'
when round(TIMESTAMPDIFF(SECOND, lww.create_time, IFNULL( lww.check_time,NOW()) )/3600,1) > #{param.hoursTime} then '超时'
else '未知'
end isOverTime
from logpm_warehouse_waybill lww
@ -2500,11 +2513,11 @@
<if test= "param.settlementStatus != null" >
and lww.settlement_status = #{param.settlementStatus}
</if>
<if test= "param.overTimeStatus != null and param.overTimeStatus == 0" >
and round(TIMESTAMPDIFF(SECOND, lww.create_time, lww.check_time)/3600,1) < = #{param.hoursTime}
<if test= "param.isOverTime != null and param.isOverTime == 0" >
and round(TIMESTAMPDIFF(SECOND, lww.create_time, IFNULL( lww.check_time,NOW()) )/3600,1) < = #{param.hoursTime}
</if>
<if test= "param.overTimeStatus != null and param.overTimeStatus == 1" >
and round(TIMESTAMPDIFF(SECOND, lww.create_time, lww.check_time)/3600,1) > #{param.hoursTime}
<if test= "param.isOverTime != null and param.isOverTime == 1" >
and round(TIMESTAMPDIFF(SECOND, lww.create_time, IFNULL( lww.check_time,NOW()) )/3600,1) > #{param.hoursTime}
</if>
<if test= "param.checkDetailType != null and param.checkDetailType == 2 " >
and lww.check_status=1
@ -2790,6 +2803,7 @@
</if>
<if test= "param.startDetailType != null and param.startDetailType ==2" >
and ltcls.id is not null
AND ltcll.start_date is not null
</if>
<if test= "param.startDetailType != null and param.startDetailType ==3" >
and ltcls.id is null
@ -2890,6 +2904,7 @@
</if>
<if test= "param.startDetailType != null and param.startDetailType ==2" >
and ltcls.id is not null
AND ltcll.start_date is not null
</if>
<if test= "param.startDetailType != null and param.startDetailType ==3" >
and ltcls.id is null
@ -2986,12 +3001,13 @@
and round(TIMESTAMPDIFF(SECOND,ldpl.create_time,IFNULL(ltcll.start_date,NOW()))/3600,1)>#{param.hoursTime}
</if>
<if test= "param.startDetailType != null and param.startDetailType ==2" >
and ltcls.id is not null
and ( ltcls.id is not null or ldpl.order_package_status != '20')
</if>
<if test= "param.startDetailType != null and param.startDetailType ==3" >
and ltcls.id is null
and ldpl.order_package_status = '20'
</if>
<if test= "param.startDetailType != null and param.startDetailType ==3 " >
<if test= "param.startDetailType != null and param.startDetailType ==4 " >
and ltcls.id is null
and now() > = DATE_ADD( ldpl.create_time, INTERVAL #{param.hoursTime} HOUR )
</if>
@ -3007,7 +3023,9 @@
ldpl.send_warehouse_name departureWarehouseName,
ldpl.accept_warehouse_name destinationWarehouseName,
ldpl.train_number trainNumber,
lta.is_gcp isGcp,
case when lta.is_gcp=0 then '否'
when lta.is_gcp=1 then '是'
else '未知' end isGcp,
ldpl.firsts firstPackName,
ldpl.`second` secondPackName,
ldpl.third_product thirdPackName,
@ -3084,12 +3102,13 @@
and round(TIMESTAMPDIFF(SECOND,ldpl.create_time,IFNULL(ltcll.start_date,NOW()))/3600,1)>#{param.hoursTime}
</if>
<if test= "param.startDetailType != null and param.startDetailType ==2" >
and ltcls.id is not null
and ( ltcls.id is not null or ldpl.order_package_status != '20')
</if>
<if test= "param.startDetailType != null and param.startDetailType ==3" >
and ltcls.id is null
and ldpl.order_package_status = '20'
</if>
<if test= "param.startDetailType != null and param.startDetailType ==3 " >
<if test= "param.startDetailType != null and param.startDetailType ==4 " >
and ltcls.id is null
and now() > = DATE_ADD( ldpl.create_time, INTERVAL #{param.hoursTime} HOUR )
</if>