case when round(TIMESTAMPDIFF(SECOND,ltad.create_time,ldpl.create_time)/3600,1)<=IFNULL(lrat.hours_time,#{param.hoursTime}) then '未超时'
when round(TIMESTAMPDIFF(SECOND,ltad.create_time,ldpl.create_time)/3600,1)>IFNULL(lrat.hours_time,#{param.hoursTime}) then '超时'
case when round(TIMESTAMPDIFF(SECOND,ltad.create_time,IFNULL(ldpl.create_time,NOW()))/3600,1)<=IFNULL(lrat.hours_time,#{param.hoursTime}) then '未超时'
when round(TIMESTAMPDIFF(SECOND,ltad.create_time,IFNULL(ldpl.create_time,NOW()))/3600,1)>IFNULL(lrat.hours_time,#{param.hoursTime}) then '超时'
else '未知' end isOverTime
from logpm_trunkline_advance_detail ltad
left join logpm_trunkline_advance lta on lta.id = ltad.advance_id
@ -2681,14 +2681,14 @@
<iftest="param.trainNumber != null and param.trainNumber != ''">
and ltad.train_number like concat('%',#{param.trainNumber},'%')
</if>
<iftest="param.isDesIncomging != null">
and IF(ldpl.id IS NULL,0,1) = #{param.isDesIncomging}
<iftest="param.isDesIncoming != null">
and IF(ldpl.id IS NULL,0,1) = #{param.isDesIncoming}
</if>
<iftest="param.isOverTime != null and param.isOverTime ==0">
and round(TIMESTAMPDIFF(SECOND,ltad.create_time,ldpl.create_time)/3600,1)<=IFNULL(lrat.hours_time,#{param.hoursTime})
and round(TIMESTAMPDIFF(SECOND,ltad.create_time,IFNULL(ldpl.create_time,NOW()))/3600,1)<=IFNULL(lrat.hours_time,#{param.hoursTime})
</if>
<iftest="param.isOverTime != null and param.isOverTime ==1">
and round(TIMESTAMPDIFF(SECOND,ltad.create_time,ldpl.create_time)/3600,1)>IFNULL(lrat.hours_time,#{param.hoursTime})
and round(TIMESTAMPDIFF(SECOND,ltad.create_time,IFNULL(ldpl.create_time,NOW()))/3600,1)>IFNULL(lrat.hours_time,#{param.hoursTime})
</if>
<iftest="param.allTrunklineTimeDetailType != null and param.allTrunklineTimeDetailType ==2">
and ldpl.id IS NOT NULL
@ -2698,7 +2698,7 @@
</if>
<iftest="param.allTrunklineTimeDetailType != null and param.allTrunklineTimeDetailType ==4">
and ldpl.id IS NOT NULL
and round(TIMESTAMPDIFF(SECOND,ltad.create_time,ldpl.create_time)/3600,1)<=IFNULL(lrat.hours_time,#{param.hoursTime})
and round(TIMESTAMPDIFF(SECOND,ltad.create_time,IFNULL(ldpl.create_time,NOW()))/3600,1)<=IFNULL(lrat.hours_time,#{param.hoursTime})
</if>
</select>
@ -2776,8 +2776,8 @@
<iftest="param.trainNumber != null and param.trainNumber != ''">
and ltad.train_number like concat('%',#{param.trainNumber},'%')
</if>
<iftest="param.isDesIncomging != null">
and if(ltcll.start_date is null,0,1) = #{param.isDesIncomging}
<iftest="param.isStarting != null">
and if(ltcll.start_date is null,0,1) = #{param.isStarting}
</if>
<iftest="param.isOverTime != null and param.isOverTime ==0">
and round(TIMESTAMPDIFF(SECOND,ltad.incoming_time,IFNULL(ltcll.start_date,NOW()))/3600,1)<=#{param.hoursTime}
@ -2876,8 +2876,8 @@
<iftest="param.trainNumber != null and param.trainNumber != ''">
and ltad.train_number like concat('%',#{param.trainNumber},'%')
</if>
<iftest="param.isDesIncomging != null">
and if(ltcll.start_date is null,0,1) = #{param.isDesIncomging}
<iftest="param.isStarting != null">
and if(ltcll.start_date is null,0,1) = #{param.isStarting}
</if>
<iftest="param.isOverTime != null and param.isOverTime ==0">
and round(TIMESTAMPDIFF(SECOND,ltad.incoming_time,IFNULL(ltcll.start_date,NOW()))/3600,1)<=#{param.hoursTime}
when TIMESTAMPDIFF(HOUR, ltb.create_time, ifnull(ltb.end_time,now())) > rpec.time then '是'
else '否' end pickupTimeout
when round(TIMESTAMPDIFF(SECOND, ltb.create_time, ifnull(ltb.end_time,now()))/3600,2) > rpec.time then '是'
else '否' end pickupTimeout,
case when lbda.type = '1' then '自有' when lbda.type = '2' then '加盟' when lbda.type = '3' then '外调' when lbda.type = '4' then '临调' end trainType,
lbcm.vehicle_model settlementType
from logpm_trunkline_billlading ltb
left join logpm_basicdata_driver_artery lbda on ltb.driver_id = lbda.id and lbda.is_deleted = 0
left join logpm_basicdata_vehicle lbv on lbv.vehicle_nub = ltb.car_number and lbv.is_deleted = 0
left join logpm_basic_car_model lbcm on lbcm.id = lbv.vehicle_model_id and lbcm.is_deleted = 0
left join logpm_warehouse_warehouse lww on lww.id = ltb.warehouse_id
left join logpm_report_pickup_efficiency_config rpec on rpec.type = 1
left join logpm_trunkline_billlading_line ltbl on ltbl.billlading_id = ltb.id and ltbl.is_deleted = 0
@ -182,14 +191,20 @@
<iftest="query.driverPhone != null and query.driverPhone != ''">
and ltb.driver_phone like concat('%',#{query.driverPhone},'%')
</if>
<iftest="query.settlementType != null and query.settlementType != ''">
and lbcm.vehicle_model like concat('%',#{query.settlementType},'%')
</if>
<iftest="query.trainType != null and query.trainType != ''">
and case when lbda.type = '1' then '自有' when lbda.type = '2' then '加盟' when lbda.type = '3' then '外调' when lbda.type = '4' then '临调' end like concat('%',#{query.trainType},'%')
</if>
<iftest="query.warehouseName != null and query.warehouseName != ''">
and ltb.warehouse_name = #{query.warehouseName}
</if>
<iftest="query.pickupStartTimeStart != null and query.pickupStartTimeStart != ''">
and ltb.create_time >= #{query.pickupStartTimeStart}
and ltb.start_time >= #{query.pickupStartTimeStart}
</if>
<iftest="query.pickupStartTimeEnd != null and query.pickupStartTimeEnd != ''">
and ltb.create_time <= #{query.pickupStartTimeEnd}
and ltb.start_time <= #{query.pickupStartTimeEnd}
</if>
<iftest="query.pickupEndTimeStart != null and query.pickupEndTimeStart != ''">
and ltb.end_time >= #{query.pickupEndTimeStart}
@ -199,10 +214,10 @@
</if>
<iftest="query.pickupTimeout != null and query.pickupTimeout != ''">
<iftest="query.pickupTimeout == '否'.toString() ">
and TIMESTAMPDIFF(HOUR, ltb.create_time, ifnull(ltb.end_time,now())) <= rpec.time
and round(TIMESTAMPDIFF(SECOND, ltb.create_time, ifnull(ltb.end_time,now()))/3600,2) <= rpec.time
</if>
<iftest="query.pickupTimeout == '是'.toString() ">
and TIMESTAMPDIFF(HOUR, ltb.create_time,ifnull(ltb.end_time,now())) > rpec.time
and round(TIMESTAMPDIFF(SECOND, ltb.create_time, ifnull(ltb.end_time,now()))/3600,2) > rpec.time
</if>
</if>
<iftest="query.pickupStatus != null and query.pickupStatus != ''">
@ -217,20 +232,20 @@
</if>
<iftest="query.type == 3">
and ltb.billlading_status in ('3', '4')
and TIMESTAMPDIFF(HOUR, ltb.create_time,ifnull(ltb.end_time,now())) <= rpec.time
and round(TIMESTAMPDIFF(SECOND, ltb.create_time, ifnull(ltb.end_time,now()))/3600,2) <= rpec.time
</if>
<iftest="query.type == 4">
and ltb.billlading_status in ('1', '2')
and TIMESTAMPDIFF(HOUR, ltb.create_time, ifnull(ltb.end_time,now())) > rpec.time
and round(TIMESTAMPDIFF(SECOND, ltb.create_time, ifnull(ltb.end_time,now()))/3600,2) > rpec.time
</if>
<iftest="query.type == 5">
and ltb.billlading_status in ('3', '4')
and TIMESTAMPDIFF(HOUR, ltb.create_time, ifnull(ltb.end_time,now())) > rpec.time
and round(TIMESTAMPDIFF(SECOND, ltb.create_time, ifnull(ltb.end_time,now()))/3600,2) > rpec.time