|
|
|
@ -131,15 +131,32 @@
|
|
|
|
|
|
|
|
|
|
<select id="findCarsLoadOrderInfoList" resultType="com.logpm.trunkline.vo.CarsLoadOrderInfoVO"> |
|
|
|
|
select ltco.order_code orderCode, |
|
|
|
|
ltco.plan_num planNum, |
|
|
|
|
ltco.real_num loadingNum, |
|
|
|
|
IFNULL(ltco.plan_num,0) planNum, |
|
|
|
|
t.loadingNum, |
|
|
|
|
lww.total_freight orderFreight, |
|
|
|
|
lww.check_user_name checkUserName, |
|
|
|
|
IFNULL(ltco.unload_num,0) unloadNum, |
|
|
|
|
IFNULL(lww.total_freight/lww.total_count*ltco.unload_num,0) unloadIncome, |
|
|
|
|
IFNULL(lww.total_freight/lww.total_count*ltco.plan_num,0) orderLineCost, |
|
|
|
|
IFNULL(lww.total_freight/lww.total_count*t.unloadNum,0) unloadIncome, |
|
|
|
|
m.costPiece, |
|
|
|
|
m.costZhang, |
|
|
|
|
sum(ltwo.total_number) orderNum |
|
|
|
|
from logpm_trunkline_cars_order ltco |
|
|
|
|
from (select ltcls.waybill_no waybillNo, |
|
|
|
|
ltcls.order_code orderCode, |
|
|
|
|
sum(IFNULL(ltcls.num,0)) loadingNum, |
|
|
|
|
sum(IFNULL(ltcls.unload_num,0)) unloadNum |
|
|
|
|
from logpm_trunkline_cars_load_scan ltcls |
|
|
|
|
where ltcls.load_id = #{loadId} |
|
|
|
|
group by ltcls.waybill_no, |
|
|
|
|
ltcls.order_code) t |
|
|
|
|
left join (select ltcsr.waybill_no waybillNo, |
|
|
|
|
ltcsr.order_code orderCode, |
|
|
|
|
sum(IFNULL(ltcsr.cost_piece,0)) costPiece, |
|
|
|
|
sum(IFNULL(ltcsr.cost_zhang,0)) costZhang |
|
|
|
|
from logpm_trunkline_cost_share_record ltcsr |
|
|
|
|
where ltcsr.load_id = #{loadId} |
|
|
|
|
group by ltcsr.waybill_no, |
|
|
|
|
ltcsr.order_code) m on m.waybillNo = t.waybillNo and m.orderCode = t.orderCode |
|
|
|
|
left join logpm_trunkline_cars_order ltco on ltco.waybill_no = t.waybillNo and ltco.order_code = t.orderCode |
|
|
|
|
left join logpm_trunkline_waybill_order ltwo on ltwo.order_code = ltco.order_code and ltwo.waybill_no = ltco.waybill_no |
|
|
|
|
left join logpm_warehouse_waybill lww on lww.waybill_no = ltwo.waybill_no |
|
|
|
|
where ltco.load_id = #{loadId} |
|
|
|
|