Browse Source

1.订单整体时效逻辑优化

fix-sign
zhenghaoyu 3 months ago
parent
commit
2d0e14c70c
  1. 202
      blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportTimeMapper.xml
  2. 18
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java

202
blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportTimeMapper.xml

@ -803,51 +803,46 @@
lww.departure_warehouse_name departureWarehouseName,
lww.destination_warehouse_name destinationWarehouseName,
lww.brand brand,
count(lww.id) waybillNum,
sum(lww.total_count) openNum,
sum(IFNULL(t.totalNum,0)) arriveNum,
sum(lww.total_count)-sum(IFNULL(t.totalNum,0)) noArriveNum,
IFNULL(round(sum(IFNULL(t.totalNum,0))/sum(lww.total_count)*100,2),'0.00') arriveRate,
round(sum(t.timeSecond)/sum(IFNULL(t.totalNum,0))/3600/24,1) avgTime,
sum(IFNULL(t.onTimeNum,0)) onTimeArriveNum,
IFNULL(round(sum(IFNULL(t.onTimeNum,0))/sum(lww.total_count)*100,2),'0.00') onTimeArriveRate,
sum(IFNULL(t.oneNum,0)) oneArriveNum,
IFNULL(round(sum(IFNULL(t.oneNum,0))/sum(lww.total_count)*100,2),'0.00') oneArriveRate,
sum(IFNULL(t.twoNum,0)) twoArriveNum,
IFNULL(round(sum(IFNULL(t.twoNum,0))/sum(lww.total_count)*100,2),'0.00') twoArriveRate,
sum(IFNULL(t.threeNum,0)) threeArriveNum,
IFNULL(round(sum(IFNULL(t.threeNum,0))/sum(lww.total_count)*100,2),'0.00') threeArriveRate,
sum(IFNULL(t.fourNum,0)) fourArriveNum,
IFNULL(round(sum(IFNULL(t.fourNum,0))/sum(lww.total_count)*100,2),'0.00') fourArriveRate,
sum(IFNULL(t.fiveNum,0)) fiveArriveNum,
IFNULL(round(sum(IFNULL(t.fiveNum,0))/sum(lww.total_count)*100,2),'0.00') fiveArriveRate,
sum(IFNULL(t.sixNum,0)) sixArriveNum,
IFNULL(round(sum(IFNULL(t.sixNum,0))/sum(lww.total_count)*100,2),'0.00') sixArriveRate,
sum(IFNULL(t.sevenNum,0)) sevenArriveNum,
IFNULL(round(sum(IFNULL(t.sevenNum,0))/sum(lww.total_count)*100,2),'0.00') sevenArriveRate,
sum(IFNULL(t.sevenToTenNum,0)) sevenToTenArriveNum,
IFNULL(round(sum(IFNULL(t.sevenToTenNum,0))/sum(lww.total_count)*100,2),'0.00') sevenToTenArriveRate,
sum(IFNULL(t.moreTenNum,0)) moreTenArriveNum,
IFNULL(round(sum(IFNULL(t.moreTenNum,0))/sum(lww.total_count)*100,2),'0.00') moreTenArriveRate
from (select ldpl.waybill_id,
sum(ldpl.quantity) totalNum,
sum(TIMESTAMPDIFF(SECOND,ltad.create_time,ldpl.create_time )) timeSecond,
sum(if(ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL IFNULL(lrat.hours_time,#{param.hoursTime}) HOUR ),1,0)) onTimeNum,
sum(if(ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 24 HOUR ),1,0)) oneNum,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 24 HOUR ) <ldpl.create_time and ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 48 HOUR ),1,0)) twoNum,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 48 HOUR )<ldpl.create_time and ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 72 HOUR ),1,0)) threeNum,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 72 HOUR )<ldpl.create_time and ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 96 HOUR ),1,0)) fourNum,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 96 HOUR )<ldpl.create_time and ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 120 HOUR ),1,0)) fiveNum,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 120 HOUR )<ldpl.create_time and ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 144 HOUR ),1,0)) sixNum,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 144 HOUR )<ldpl.create_time and ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 168 HOUR ),1,0)) sevenNum,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 168 HOUR )<ldpl.create_time and ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 240 HOUR ),1,0)) sevenToTenNum,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 240 HOUR )<ldpl.create_time,1,0)) moreTenNum
from logpm_distribution_parcel_list ldpl
left join logpm_trunkline_advance_detail ltad on ltad.order_package_code = ldpl.order_package_code
IFNULL(lrat.hours_time,#{param.hoursTime}) hoursTime,
count(DISTINCT ltad.waybill_id) waybillNum,
count(ltad.id) openNum,
IFNULL(sum(ldpl.quantity),0) arriveNum,
count(ltad.id)-IFNULL(sum(ldpl.quantity),0) noArriveNum,
IFNULL(round(IFNULL(sum(ldpl.quantity),0)/count(ltad.id)*100,2),'0.00') arriveRate,
round(sum(TIMESTAMPDIFF(SECOND,ltad.create_time,ldpl.create_time ))/sum(ldpl.quantity)/3600/24,1) avgTime,
sum(if(ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL IFNULL(lrat.hours_time,#{param.hoursTime}) HOUR ),1,0)) onTimeArriveNum,
IFNULL(round(sum(if(ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL IFNULL(lrat.hours_time,0) HOUR ),1,0))/sum(ldpl.quantity)*100,2),'0.00') onTimeArriveRate,
sum(if(ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 24 HOUR ),1,0)) oneArriveNum,
IFNULL(round(sum(if(ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 24 HOUR ),1,0))/sum(ldpl.quantity)*100,2),'0.00') oneArriveRate,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 24 HOUR ) <ldpl.create_time and ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 48 HOUR ),1,0)) twoArriveNum,
IFNULL(round(sum(if(DATE_ADD( ltad.create_time, INTERVAL 24 HOUR ) <ldpl.create_time and ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 48 HOUR ),1,0))/sum(ldpl.quantity)*100,2),'0.00') twoArriveRate,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 48 HOUR )<ldpl.create_time and ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 72 HOUR ),1,0)) threeArriveNum,
IFNULL(round(sum(if(DATE_ADD( ltad.create_time, INTERVAL 48 HOUR ) <ldpl.create_time and ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 72 HOUR ),1,0))/sum(ldpl.quantity)*100,2),'0.00') threeArriveRate,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 72 HOUR )<ldpl.create_time and ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 96 HOUR ),1,0)) fourArriveNum,
IFNULL(round(sum(if(DATE_ADD( ltad.create_time, INTERVAL 72 HOUR ) <ldpl.create_time and ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 96 HOUR ),1,0))/sum(ldpl.quantity)*100,2),'0.00') fourArriveRate,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 96 HOUR )<ldpl.create_time and ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 120 HOUR ),1,0)) fiveArriveNum,
IFNULL(round(sum(if(DATE_ADD( ltad.create_time, INTERVAL 96 HOUR ) <ldpl.create_time and ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 120 HOUR ),1,0))/sum(ldpl.quantity)*100,2),'0.00') fiveArriveRate,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 120 HOUR )<ldpl.create_time and ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 144 HOUR ),1,0)) sixArriveNum,
IFNULL(round(sum(if(DATE_ADD( ltad.create_time, INTERVAL 120 HOUR ) <ldpl.create_time and ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 144 HOUR ),1,0))/sum(ldpl.quantity)*100,2),'0.00') sixArriveRate,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 144 HOUR )<ldpl.create_time and ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 168 HOUR ),1,0)) sevenArriveNum,
IFNULL(round(sum(if(DATE_ADD( ltad.create_time, INTERVAL 144 HOUR ) <ldpl.create_time and ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 168 HOUR ),1,0))/sum(ldpl.quantity)*100,2),'0.00') sevenArriveRate,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 168 HOUR )<ldpl.create_time and ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 240 HOUR ),1,0)) sevenToTenArriveNum,
IFNULL(round(sum(if(DATE_ADD( ltad.create_time, INTERVAL 168 HOUR ) <ldpl.create_time and ldpl.create_time <= DATE_ADD( ltad.create_time, INTERVAL 240 HOUR ),1,0))/sum(ldpl.quantity)*100,2),'0.00') sevenToTenArriveRate,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 240 HOUR )<ldpl.create_time,1,0)) moreTenArriveNum,
IFNULL(round(sum(if(DATE_ADD( ltad.create_time, INTERVAL 240 HOUR )<ldpl.create_time,1,0))/sum(ldpl.quantity)*100,2),'0.00') moreTenArriveRate
from logpm_trunkline_advance_detail ltad
left join logpm_warehouse_waybill lww on lww.id = ltad.waybill_id
left join logpm_warehouse_warehouse waw on waw.id = lww.departure_warehouse_id
left join logpm_distribution_parcel_list ldpl on ltad.order_package_code = ldpl.order_package_code and ldpl.warehouse_id = lww.destination_warehouse_id
left join logpm_reportconfig_all_trunkline lrat on lrat.departure_warehouse_id = ldpl.send_warehouse_id and lrat.destination_warehouse_id = ldpl.accept_warehouse_id and lrat.is_deleted=0
where ldpl.conditions != 3
and ldpl.send_warehouse_id != ldpl.accept_warehouse_id
and ltad.create_time > '2024-10-22 00:00:00'
where 1=1
and lww.departure_warehouse_id != lww.destination_warehouse_id
<if test="param.businessLineList != null and param.businessLineList.size() > 0">
and waw.business_line in
<foreach collection="param.businessLineList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.startTime != null ">
and ltad.create_time &gt;= #{param.startTime}
</if>
@ -855,35 +850,23 @@
and ltad.create_time &lt;= #{param.endTime}
</if>
<if test="param.brandList != null and param.brandList.size() > 0">
and ltad.brand in
and lww.brand in
<foreach collection="param.brandList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.departureWarehouseIds != null and param.departureWarehouseIds.size() > 0">
and ldpl.send_warehouse_id in
and lww.departure_warehouse_id in
<foreach collection="param.departureWarehouseIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.destinationWarehouseIds != null and param.destinationWarehouseIds.size() > 0">
and ldpl.accept_warehouse_id in
and lww.destination_warehouse_id in
<foreach collection="param.destinationWarehouseIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
and ldpl.warehouse_id = ldpl.accept_warehouse_id
and ldpl.warehouse_id != ldpl.send_warehouse_id
group by ldpl.waybill_id) t
left join logpm_warehouse_waybill lww on lww.id = t.waybill_id
left join logpm_warehouse_warehouse waw on waw.id = lww.departure_warehouse_id
where 1=1
<if test="param.businessLineList != null and param.businessLineList.size() > 0">
and waw.business_line in
<foreach collection="param.businessLineList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by waw.business_line,
lww.departure_warehouse_name,
lww.destination_warehouse_name,
@ -896,51 +879,46 @@
lww.departure_warehouse_name departureWarehouseName,
lww.destination_warehouse_name destinationWarehouseName,
lww.brand brand,
count(lww.id) waybillNum,
sum(lww.total_count) openNum,
sum(IFNULL(t.totalNum,0)) arriveNum,
sum(lww.total_count)-sum(IFNULL(t.totalNum,0)) noArriveNum,
IFNULL(concat(round(sum(IFNULL(t.totalNum,0))/sum(lww.total_count)*100,2),'%'),'0.00%') arriveRate,
round(sum(t.timeSecond)/sum(IFNULL(t.totalNum,0))/3600/24,1) avgTime,
sum(IFNULL(t.onTimeNum,0)) onTimeArriveNum,
IFNULL(concat(round(sum(IFNULL(t.onTimeNum,0))/sum(lww.total_count)*100,2),'%'),'0.00%') onTimeArriveRate,
sum(IFNULL(t.oneNum,0)) oneArriveNum,
IFNULL(concat(round(sum(IFNULL(t.oneNum,0))/sum(lww.total_count)*100,2),'%'),'0.00%') oneArriveRate,
sum(IFNULL(t.twoNum,0)) twoArriveNum,
IFNULL(concat(round(sum(IFNULL(t.twoNum,0))/sum(lww.total_count)*100,2),'%'),'0.00%') twoArriveRate,
sum(IFNULL(t.threeNum,0)) threeArriveNum,
IFNULL(concat(round(sum(IFNULL(t.threeNum,0))/sum(lww.total_count)*100,2),'%'),'0.00%') threeArriveRate,
sum(IFNULL(t.fourNum,0)) fourArriveNum,
IFNULL(concat(round(sum(IFNULL(t.fourNum,0))/sum(lww.total_count)*100,2),'%'),'0.00%') fourArriveRate,
sum(IFNULL(t.fiveNum,0)) fiveArriveNum,
IFNULL(concat(round(sum(IFNULL(t.fiveNum,0))/sum(lww.total_count)*100,2),'%'),'0.00%') fiveArriveRate,
sum(IFNULL(t.sixNum,0)) sixArriveNum,
IFNULL(concat(round(sum(IFNULL(t.sixNum,0))/sum(lww.total_count)*100,2),'%'),'0.00%') sixArriveRate,
sum(IFNULL(t.sevenNum,0)) sevenArriveNum,
IFNULL(concat(round(sum(IFNULL(t.sevenNum,0))/sum(lww.total_count)*100,2),'%'),'0.00%') sevenArriveRate,
sum(IFNULL(t.sevenToTenNum,0)) sevenToTenArriveNum,
IFNULL(concat(round(sum(IFNULL(t.sevenToTenNum,0))/sum(lww.total_count)*100,2),'%'),'0.00%') sevenToTenArriveRate,
sum(IFNULL(t.moreTenNum,0)) moreTenArriveNum,
IFNULL(concat(round(sum(IFNULL(t.moreTenNum,0))/sum(lww.total_count)*100,2),'%'),'0.00%') moreTenArriveRate
from (select ldpl.waybill_id,
sum(ldpl.quantity) totalNum,
sum(TIMESTAMPDIFF(SECOND,ltad.create_time,ldpl.create_time )) timeSecond,
sum(if(ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL IFNULL(lrat.hours_time,#{param.hoursTime}) HOUR ),1,0)) onTimeNum,
sum(if(ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 24 HOUR ),1,0)) oneNum,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 24 HOUR ) &lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 48 HOUR ),1,0)) twoNum,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 48 HOUR )&lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 72 HOUR ),1,0)) threeNum,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 72 HOUR )&lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 96 HOUR ),1,0)) fourNum,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 96 HOUR )&lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 120 HOUR ),1,0)) fiveNum,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 120 HOUR )&lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 144 HOUR ),1,0)) sixNum,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 144 HOUR )&lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 168 HOUR ),1,0)) sevenNum,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 168 HOUR )&lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 240 HOUR ),1,0)) sevenToTenNum,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 240 HOUR )&lt;ldpl.create_time,1,0)) moreTenNum
from logpm_distribution_parcel_list ldpl
left join logpm_trunkline_advance_detail ltad on ltad.order_package_code = ldpl.order_package_code
IFNULL(lrat.hours_time,#{param.hoursTime}) hoursTime,
count(DISTINCT ltad.waybill_id) waybillNum,
count(ltad.id) openNum,
IFNULL(sum(ldpl.quantity),0) arriveNum,
count(ltad.id)-IFNULL(sum(ldpl.quantity),0) noArriveNum,
IFNULL(concat(round(IFNULL(sum(ldpl.quantity),0)/count(ltad.id)*100,2),'%'),'0.00%') arriveRate,
round(sum(TIMESTAMPDIFF(SECOND,ltad.create_time,ldpl.create_time ))/sum(ldpl.quantity)/3600/24,1) avgTime,
sum(if(ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL IFNULL(lrat.hours_time,#{param.hoursTime}) HOUR ),1,0)) onTimeArriveNum,
IFNULL(concat(round(sum(if(ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL IFNULL(lrat.hours_time,0) HOUR ),1,0))/sum(ldpl.quantity)*100,2),'%'),'0.00%') onTimeArriveRate,
sum(if(ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 24 HOUR ),1,0)) oneArriveNum,
IFNULL(concat(round(sum(if(ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 24 HOUR ),1,0))/sum(ldpl.quantity)*100,2),'%'),'0.00%') oneArriveRate,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 24 HOUR ) &lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 48 HOUR ),1,0)) twoArriveNum,
IFNULL(concat(round(sum(if(DATE_ADD( ltad.create_time, INTERVAL 24 HOUR ) &lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 48 HOUR ),1,0))/sum(ldpl.quantity)*100,2),'%'),'0.00%') twoArriveRate,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 48 HOUR )&lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 72 HOUR ),1,0)) threeArriveNum,
IFNULL(concat(round(sum(if(DATE_ADD( ltad.create_time, INTERVAL 48 HOUR ) &lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 72 HOUR ),1,0))/sum(ldpl.quantity)*100,2),'%'),'0.00%') threeArriveRate,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 72 HOUR )&lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 96 HOUR ),1,0)) fourArriveNum,
IFNULL(concat(round(sum(if(DATE_ADD( ltad.create_time, INTERVAL 72 HOUR ) &lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 96 HOUR ),1,0))/sum(ldpl.quantity)*100,2),'%'),'0.00%') fourArriveRate,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 96 HOUR )&lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 120 HOUR ),1,0)) fiveArriveNum,
IFNULL(concat(round(sum(if(DATE_ADD( ltad.create_time, INTERVAL 96 HOUR ) &lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 120 HOUR ),1,0))/sum(ldpl.quantity)*100,2),'%'),'0.00%') fiveArriveRate,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 120 HOUR )&lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 144 HOUR ),1,0)) sixArriveNum,
IFNULL(concat(round(sum(if(DATE_ADD( ltad.create_time, INTERVAL 120 HOUR ) &lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 144 HOUR ),1,0))/sum(ldpl.quantity)*100,2),'%'),'0.00%') sixArriveRate,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 144 HOUR )&lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 168 HOUR ),1,0)) sevenArriveNum,
IFNULL(concat(round(sum(if(DATE_ADD( ltad.create_time, INTERVAL 144 HOUR ) &lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 168 HOUR ),1,0))/sum(ldpl.quantity)*100,2),'%'),'0.00%') sevenArriveRate,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 168 HOUR )&lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 240 HOUR ),1,0)) sevenToTenArriveNum,
IFNULL(concat(round(sum(if(DATE_ADD( ltad.create_time, INTERVAL 168 HOUR ) &lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 240 HOUR ),1,0))/sum(ldpl.quantity)*100,2),'%'),'0.00%') sevenToTenArriveRate,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 240 HOUR )&lt;ldpl.create_time,1,0)) moreTenArriveNum,
IFNULL(concat(round(sum(if(DATE_ADD( ltad.create_time, INTERVAL 240 HOUR )&lt;ldpl.create_time,1,0))/sum(ldpl.quantity)*100,2),'%'),'0.00%') moreTenArriveRate
from logpm_trunkline_advance_detail ltad
left join logpm_warehouse_waybill lww on lww.id = ltad.waybill_id
left join logpm_warehouse_warehouse waw on waw.id = lww.departure_warehouse_id
left join logpm_distribution_parcel_list ldpl on ltad.order_package_code = ldpl.order_package_code and ldpl.warehouse_id = lww.destination_warehouse_id
left join logpm_reportconfig_all_trunkline lrat on lrat.departure_warehouse_id = ldpl.send_warehouse_id and lrat.destination_warehouse_id = ldpl.accept_warehouse_id and lrat.is_deleted=0
where ldpl.conditions != 3
and ldpl.send_warehouse_id != ldpl.accept_warehouse_id
and ltad.create_time > '2024-10-22 00:00:00'
where 1=1
and lww.departure_warehouse_id != lww.destination_warehouse_id
<if test="param.businessLineList != null and param.businessLineList.size() > 0">
and waw.business_line in
<foreach collection="param.businessLineList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.startTime != null ">
and ltad.create_time &gt;= #{param.startTime}
</if>
@ -948,35 +926,23 @@
and ltad.create_time &lt;= #{param.endTime}
</if>
<if test="param.brandList != null and param.brandList.size() > 0">
and ltad.brand in
and lww.brand in
<foreach collection="param.brandList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.departureWarehouseIds != null and param.departureWarehouseIds.size() > 0">
and ldpl.send_warehouse_id in
and lww.departure_warehouse_id in
<foreach collection="param.departureWarehouseIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.destinationWarehouseIds != null and param.destinationWarehouseIds.size() > 0">
and ldpl.accept_warehouse_id in
and lww.destination_warehouse_id in
<foreach collection="param.destinationWarehouseIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
and ldpl.warehouse_id = ldpl.accept_warehouse_id
and ldpl.warehouse_id != ldpl.send_warehouse_id
group by ldpl.waybill_id) t
left join logpm_warehouse_waybill lww on lww.id = t.waybill_id
left join logpm_warehouse_warehouse waw on waw.id = lww.departure_warehouse_id
where 1=1
<if test="param.businessLineList != null and param.businessLineList.size() > 0">
and waw.business_line in
<foreach collection="param.businessLineList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by waw.business_line,
lww.departure_warehouse_name,
lww.destination_warehouse_name,

18
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java

@ -1127,14 +1127,16 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
String goodsName = waybillDetailDTO.getGoodsName();
if (Objects.isNull(goodsId)) {
//如果品名id没有就先通过goodsName查寻,没有就新增
BasicdataCategoryEntity basicdataCategoryEntity = basicdataCategoryClient.findByName(goodsName);
if (Objects.isNull(basicdataCategoryEntity)) {
basicdataCategoryEntity = new BasicdataCategoryEntity();
basicdataCategoryEntity.setName(goodsName);
basicdataCategoryEntity.setType("1");
goodsId = basicdataCategoryClient.addReturnId(basicdataCategoryEntity);
} else {
goodsId = basicdataCategoryEntity.getId();
if(StringUtil.isNotBlank(goodsName)){
BasicdataCategoryEntity basicdataCategoryEntity = basicdataCategoryClient.findByName(goodsName.trim());
if (Objects.isNull(basicdataCategoryEntity)) {
basicdataCategoryEntity = new BasicdataCategoryEntity();
basicdataCategoryEntity.setName(goodsName);
basicdataCategoryEntity.setType("1");
goodsId = basicdataCategoryClient.addReturnId(basicdataCategoryEntity);
} else {
goodsId = basicdataCategoryEntity.getId();
}
}
}
warehouseWayBillDetail.setProductId(goodsId);

Loading…
Cancel
Save