Commit c29db821 authored by honghy's avatar honghy

控货详情收货人查询调整

parent 4e67e336
......@@ -5,57 +5,59 @@
<select id="orderCargoControlDetailListCount" resultType="java.lang.Long">
SELECT count(1)
FROM ecw_order_cargo_control_pick occ
JOIN ecw_order o on o.order_id = occ.order_id
LEFT JOIN ecw_order_consignor nor ON nor.order_id = o.order_id AND nor.deleted = 0
LEFT JOIN ecw_order_consignee nee ON nee.order_id = o.order_id AND nee.deleted = 0
LEFT JOIN ecw_warehouse_line ewl on ewl.id = o.line_id
LEFT JOIN ecw_warehouse ew_start ON ew_start.id = ewl.start_warehouse_id
LEFT JOIN ecw_warehouse ew_dest ON ew_dest.id = ewl.dest_warehouse_id
LEFT JOIN ecw_channel ec on ec.channel_id = o.channel_id
JOIN ecw_order o on o.order_id = occ.order_id
LEFT JOIN ecw_order_consignor nor ON nor.order_id = o.order_id AND nor.deleted = 0
LEFT JOIN ecw_customer_contacts ecc on ecc.phone_new = occ.consignee_phone AND ecc.deleted = 0
LEFT JOIN ecw_order_consignor nee ON nee.customer_id = ecc.customer_id AND nee.deleted = 0
LEFT JOIN ecw_warehouse_line ewl on ewl.id = o.line_id
LEFT JOIN ecw_warehouse ew_start ON ew_start.id = ewl.start_warehouse_id
LEFT JOIN ecw_warehouse ew_dest ON ew_dest.id = ewl.dest_warehouse_id
LEFT JOIN ecw_channel ec on ec.channel_id = o.channel_id
<include refid="query"/>
</select>
<select id="orderCargoControlDetailList"
resultType="cn.iocoder.yudao.module.order.dto.OrderCargoControlReleaseInfoDto">
SELECT o.order_no,
o.order_id,
nor.customer_number as consignerNumber,
nor.customer_id as consignerId,
nee.customer_number as consigneeNumber,
nee.customer_id as consigneeId,
nee.NAME as consigneeName,
nee.phone as consigneePhone,
nee.country_code as consigneeCountryCode,
o.sum_num,
occ.pick_num,
occ.pick_volume,
truncate(ceil((round((occ.pick_num/o.sum_num)*occ.pick_volume,5))*100)/100,2) as chargeVolume,
occ.pick_weight,
truncate(ceil((round((occ.pick_num/o.sum_num)*occ.pick_weight,5))*100)/100,2) as chargeWeight,
occ.status,
occ.remarks,
occ.operator,
occ.create_time,
occ.check_time,
o.cargo_control_status as cargoControlStatus,
ew_start.title_zh as startTitleZh,
ew_start.title_en as startTitleEn,
ew_start.title_fr as startTitleFr,
o.transport_id,
ew_dest.address_zh as destCityTitleZh,
ew_dest.address_en as destCityTitleEn,
ew_dest.address_fr as destCityTitleFr,
o.create_time as unloadTime,
ec.name_zh as channelName,
occ.id
o.order_id,
nor.customer_number as consignerNumber,
nor.customer_id as consignerId,
nee.customer_number as consigneeNumber,
nee.customer_id as consigneeId,
nee.NAME as consigneeName,
nee.phone as consigneePhone,
nee.country_code as consigneeCountryCode,
o.sum_num,
occ.pick_num,
occ.pick_volume,
truncate(ceil((round((occ.pick_num/o.sum_num)*occ.pick_volume,5))*100)/100,2) as chargeVolume,
occ.pick_weight,
truncate(ceil((round((occ.pick_num/o.sum_num)*occ.pick_weight,5))*100)/100,2) as chargeWeight,
occ.status,
occ.remarks,
occ.operator,
occ.create_time,
occ.check_time,
o.cargo_control_status as cargoControlStatus,
ew_start.title_zh as startTitleZh,
ew_start.title_en as startTitleEn,
ew_start.title_fr as startTitleFr,
o.transport_id,
ew_dest.address_zh as destCityTitleZh,
ew_dest.address_en as destCityTitleEn,
ew_dest.address_fr as destCityTitleFr,
o.create_time as unloadTime,
ec.name_zh as channelName,
occ.id
FROM ecw_order_cargo_control_pick occ
JOIN ecw_order o on o.order_id = occ.order_id
LEFT JOIN ecw_order_consignor nor ON nor.order_id = o.order_id AND nor.deleted = 0
LEFT JOIN ecw_order_consignor nee ON nee.phone = occ.consignee_phone AND nee.deleted = 0
LEFT JOIN ecw_warehouse_line ewl on ewl.id = o.line_id
LEFT JOIN ecw_warehouse ew_start ON ew_start.id = ewl.start_warehouse_id
LEFT JOIN ecw_warehouse ew_dest ON ew_dest.id = ewl.dest_warehouse_id
LEFT JOIN ecw_channel ec on ec.channel_id = o.channel_id
JOIN ecw_order o on o.order_id = occ.order_id
LEFT JOIN ecw_order_consignor nor ON nor.order_id = o.order_id AND nor.deleted = 0
LEFT JOIN ecw_customer_contacts ecc on ecc.phone_new = occ.consignee_phone AND ecc.deleted = 0
LEFT JOIN ecw_order_consignor nee ON nee.customer_id = ecc.customer_id AND nee.deleted = 0
LEFT JOIN ecw_warehouse_line ewl on ewl.id = o.line_id
LEFT JOIN ecw_warehouse ew_start ON ew_start.id = ewl.start_warehouse_id
LEFT JOIN ecw_warehouse ew_dest ON ew_dest.id = ewl.dest_warehouse_id
LEFT JOIN ecw_channel ec on ec.channel_id = o.channel_id
<include refid="query"/>
<choose>
<when test="sort != null">
......@@ -77,7 +79,8 @@
FROM ecw_order_cargo_control_pick occ
JOIN ecw_order o on o.order_id = occ.order_id
LEFT JOIN ecw_order_consignor nor ON nor.order_id = o.order_id AND nor.deleted = 0
LEFT JOIN ecw_order_consignee nee ON nee.order_id = o.order_id AND nee.deleted = 0
LEFT JOIN ecw_customer_contacts ecc on ecc.phone_new = occ.consignee_phone AND ecc.deleted = 0
LEFT JOIN ecw_order_consignor nee ON nee.customer_id = ecc.customer_id AND nee.deleted = 0
LEFT JOIN ecw_warehouse_line ewl on ewl.id = o.line_id
LEFT JOIN ecw_warehouse ew_start ON ew_start.id = ewl.start_warehouse_id
LEFT JOIN ecw_warehouse ew_dest ON ew_dest.id = ewl.dest_warehouse_id
......@@ -149,12 +152,13 @@
AND occ.check_time between #{query.beginCheckTime} and #{query.endCheckTime}
</if>
<!--控货状态-->
<if test = 'query.cargoControlStatusList != null and query.cargoControlStatusList.size() > 0 '>
<if test='query.cargoControlStatusList != null and query.cargoControlStatusList.size() > 0 '>
AND (1!=1
<foreach item='cargoControlStatus' index="index" collection='query.cargoControlStatusList'>
<choose>
<when test="cargoControlStatus == 3">
or o.`cargo_control_status` = 1 AND (select count(1) from ecw_order_cargo_control_pick ccp2 where ccp2.order_id = o.order_id and ccp2.status = 1) > 0
or o.`cargo_control_status` = 1 AND (select count(1) from ecw_order_cargo_control_pick ccp2
where ccp2.order_id = o.order_id and ccp2.status = 1) > 0
</when>
<otherwise>
or o.`cargo_control_status` = #{cargoControlStatus}
......@@ -187,7 +191,8 @@
<!--目的国-->
<if test="query.destCountryIds != null and query.destCountryIds.size()>0 ">
and ew_dest.`guojia` in
<foreach item='destCountry' index='index' collection='query.destCountryIds' open='(' separator=',' close=')'>
<foreach item='destCountry' index='index' collection='query.destCountryIds' open='(' separator=','
close=')'>
#{destCountry}
</foreach>
</if>
......@@ -201,7 +206,8 @@
<!--出货渠道-->
<if test="query.shippingChannelIdList != null and query.shippingChannelIdList.size()>0 ">
and ec.channel_id in
<foreach item='id' index='index' collection='query.shippingChannelIdList' open='(' separator=',' close=')'>
<foreach item='id' index='index' collection='query.shippingChannelIdList' open='(' separator=','
close=')'>
#{id}
</foreach>
</if>
......@@ -229,8 +235,10 @@
AND o.`status` > 5 AND o.`load_time` between #{query.beginLoadTime} and #{query.endLoadTime}
</if>
<if test="query.beginOutboundTime != null and query.endOutboundTime != null ">
AND o.`status` > 5 AND o.container_number in(select distinct b.self_no from ecw_box_air_checkout bc join ecw_box b ON bc.shipment_id = b.id
where b.deleted = 0 and bc.deleted = 0 and bc.`checkout_time` between #{query.beginOutboundTime} and #{query.endOutboundTime})
AND o.`status` > 5 AND o.container_number in(select distinct b.self_no from ecw_box_air_checkout bc join
ecw_box b ON bc.shipment_id = b.id
where b.deleted = 0 and bc.deleted = 0 and bc.`checkout_time` between #{query.beginOutboundTime} and
#{query.endOutboundTime})
</if>
<if test="query.beginDaogangTime != null and query.endDaogangTime != null ">
AND o.`daogang_time` between #{query.beginDaogangTime} and #{query.endDaogangTime}
......@@ -249,7 +257,8 @@
AND o.`take_time` between #{query.beginTakeTime} and #{query.endTakeTime}
</if>
<if test="query.beginPickTime != null and query.endPickTime != null ">
AND o.order_id in(select distinct op.order_id from ecw_order_cargo_control_pick op where op.deleted = 0 and
AND o.order_id in(select distinct op.order_id from ecw_order_cargo_control_pick op where op.deleted = 0
and
op.status in(1,3) and op.`create_time` between #{query.beginPickTime} and #{query.endPickTime})
</if>
AND occ.deleted = 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment