Commit a3acd705 authored by Smile's avatar Smile
parents 49a083e1 3cc04422
......@@ -7,7 +7,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_customer nee ON nee.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
......@@ -21,11 +22,11 @@
o.order_id,
nor.customer_number as consignerNumber,
nor.customer_id as consignerId,
nee.customer_number as consigneeNumber,
nee.customer_id as consigneeId,
nee.number as consigneeNumber,
nee.id as consigneeId,
nee.NAME as consigneeName,
nee.phone as consigneePhone,
nee.country_code as consigneeCountryCode,
occ.consignee_phone as consigneePhone,
occ.consignee_country_code as consigneeCountryCode,
o.sum_num,
occ.pick_num,
occ.pick_volume,
......@@ -51,7 +52,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_consignor nee ON nee.phone = occ.consignee_phone AND nee.deleted = 0
LEFT JOIN ecw_customer_contacts ecc on ecc.phone_new = occ.consignee_phone AND ecc.deleted = 0
LEFT JOIN ecw_customer nee ON nee.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
......@@ -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_customer nee ON nee.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
......@@ -102,16 +105,16 @@
</if>
<!--提单号-->
<if test="query.prodKey != null and query.prodKey != '' ">
AND occ.tidan_No like concat("%",#{query.prodKey},"%")
AND o.tidan_No like concat("%",#{query.prodKey},"%")
</if>
<if test="query.eqProdKey != null and query.eqProdKey != '' ">
AND occ.tidan_No = #{query.eqProdKey}
AND o.tidan_No = #{query.eqProdKey}
</if>
<if test="query.notEqProdKey != null and query.notEqProdKey != '' ">
AND occ.tidan_No != #{query.notEqProdKey}
AND o.tidan_No != #{query.notEqProdKey}
</if>
<if test="query.notProdKey != null and query.notProdKey != '' ">
AND occ.tidan_No not like concat("%",#{query.notProdKey},"%")
AND o.tidan_No not like concat("%",#{query.notProdKey},"%")
</if>
<!--发货人-->
<if test="query.consignorKey != null and query.consignorKey != '' ">
......@@ -122,8 +125,9 @@
<!--收货人-->
<if test="query.consigneeKey != null and query.consigneeKey != '' ">
AND (nee.name like concat("%",#{query.consigneeKey},"%") or
nee.phone like concat("%",#{query.consigneeKey},"%") or
nee.customer_number like concat("%",#{query.consigneeKey},"%") )
occ.consignee_phone like concat("%",#{query.consigneeKey},"%") or
nee.number like concat("%",#{query.consigneeKey},"%") or
occ.consignee_name like concat("%",#{query.consigneeKey},"%") )
</if>
<!--状态-->
<if test="query.pickStateList != null and query.pickStateList.size >0">
......@@ -149,12 +153,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 +192,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 +207,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 +236,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 +258,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