left join logpm_trunkline_advance lta on lta.id = ltad.advance_id
left join logpm_trunkline_advance lta on lta.id = ltad.advance_id
left join logpm_warehouse_tray_goods lwtg on lwtg.association_value = ltad.order_package_code
left join logpm_warehouse_tray_goods lwtg on lwtg.association_value = ltad.order_package_code
@ -220,7 +221,7 @@
select
select
ltad.waybill_id waybillId,
ltad.waybill_id waybillId,
ltad.waybill_no waybillNo,
ltad.waybill_no waybillNo,
t.warehouse nowWarehouseName,
ltad.now_warehouse_name nowWarehouseName,
ltad.train_number trainNumber,
ltad.train_number trainNumber,
ltad.package_status packageStatus,
ltad.package_status packageStatus,
lta.is_gcp isGcp,
lta.is_gcp isGcp,
@ -250,40 +251,17 @@
lta.create_user_name createUserName,
lta.create_user_name createUserName,
lta.create_time createTime
lta.create_time createTime
from logpm_trunkline_advance_detail ltad
from logpm_trunkline_advance_detail ltad
left join logpm_trunkline_advance lta on lta.id = ltad.advance_id
left join logpm_trunkline_advance lta on lta.id = ltad.advance_id
left join (select ldpl.* from logpm_distribution_parcel_list ldpl
left join logpm_warehouse_tray_goods lwtg on lwtg.association_value = ltad.order_package_code and lwtg.warehouse_id = ltad.now_warehouse_id
join (
left join logpm_warehouse_tray lwt on lwtg.tray_id = lwt.id
select pl.order_package_code,
left join (select ltcls.* from logpm_trunkline_cars_load_scan ltcls
max(pl.update_time) updateTime
join (
from logpm_distribution_parcel_list pl
select cls.scan_code,
where 1=1
max(cls.update_time) cupdateTime
<iftest="param.orderCode != null and param.orderCode != '' ">
from logpm_trunkline_cars_load_scan cls
and LOCATE(#{param.orderCode}, pl.order_code) > 0
group by cls.scan_code
</if>
) cmax on cmax.scan_code = ltcls.scan_code and cmax.cupdateTime = ltcls.update_time) m on m.scan_code = t.order_package_code
<iftest="param.waybillNo != null and param.waybillNo != '' ">
left join logpm_distribution_loadscan ldl on ldl.order_package_code = t.order_package_code and ldl.scan_status != 1 and ldl.is_deleted = 0
and pl.waybill_no = #{param.waybillNo}
</if>
<iftest="param.trainNumber != null and param.trainNumber != '' ">
and pl.train_number = #{param.trainNumber}
</if>
<iftest="param.serviceNumber != null and param.serviceNumber != '' ">
and pl.service_number = #{param.serviceNumber}
</if>
<iftest="param.orderPackageCode != null and param.orderPackageCode != '' ">
and LOCATE(#{param.orderPackageCode},pl.order_package_code) > 0
</if>
group by pl.order_package_code
) tmax on tmax.order_package_code = ldpl.order_package_code and ldpl.update_time = tmax.updateTime) t on t.order_package_code = ltad.order_package_code
left join logpm_warehouse_tray_goods lwtg on lwtg.association_value = t.order_package_code and lwtg.warehouse_id = t.warehouse_id
left join logpm_warehouse_tray lwt on lwtg.tray_id = lwt.id
left join (select ltcls.* from logpm_trunkline_cars_load_scan ltcls
join (
select cls.scan_code,
max(cls.update_time) cupdateTime
from logpm_trunkline_cars_load_scan cls
group by cls.scan_code
) cmax on cmax.scan_code = ltcls.scan_code and cmax.cupdateTime = ltcls.update_time) m on m.scan_code = t.order_package_code
left join logpm_distribution_loadscan ldl on ldl.order_package_code = t.order_package_code and ldl.scan_status != 1 and ldl.is_deleted = 0
left join logpm_distribution_delivery_list lddl on lddl.id = ldl.delivery_id
left join logpm_distribution_delivery_list lddl on lddl.id = ldl.delivery_id
where 1=1
where 1=1
<iftest="param.orderCode != null and param.orderCode != '' ">
<iftest="param.orderCode != null and param.orderCode != '' ">
left join logpm_warehouse_waybill lww on ltcls.waybill_no = lww.waybill_no
left join logpm_warehouse_waybill lww on ltcls.waybill_no = lww.waybill_no
where ltcls.load_id = #{loadId}
where ltcls.load_id = #{loadId}
and ltcls.warehouse_id = #{warehouseId}
and ltcls.warehouse_id = #{warehouseId}
and ltcls.warehouse_id != ltcls.unload_node_id
group by ltcls.order_code,
group by ltcls.order_code,
ltcls.waybill_no,
ltcls.waybill_no,
ltcls.type,
ltcls.type,
@ -446,9 +447,9 @@
lww.consignee consignee,
lww.consignee consignee,
lww.consignee_name consigneeName,
lww.consignee_name consigneeName,
lww.consignee_mobile consigneeMobile,
lww.consignee_mobile consigneeMobile,
ltco.unload_num unloadNum,
IFNULL(ltco.plan_num,0) AS planNum,
0 planNum,
sum(case when ltcls.scan_status != 1 then ltcls.num else 0 end) unloadNum,
sum(ltcls.num) smallTotal
sum(ltcls.num) AS smallTota
from logpm_trunkline_cars_load_scan ltcls
from logpm_trunkline_cars_load_scan ltcls
left join logpm_trunkline_cars_order ltco on ltco.order_code = ltcls.order_code and ltco.waybill_no = ltcls.waybill_no and ltco.load_id = ltcls.load_id and ltco.node_id = ltcls.warehouse_id
left join logpm_trunkline_cars_order ltco on ltco.order_code = ltcls.order_code and ltco.waybill_no = ltcls.waybill_no and ltco.load_id = ltcls.load_id and ltco.node_id = ltcls.warehouse_id
left join logpm_distribution_stock_article ldsa on ldsa.order_code = ltcls.order_code and ldsa.warehouse_id = ltcls.from_warehouse_id
left join logpm_distribution_stock_article ldsa on ldsa.order_code = ltcls.order_code and ldsa.warehouse_id = ltcls.from_warehouse_id