<iftest="query.salesmanId != null and query.creator != null ">
AND (o.`salesman_id` = #{query.salesmanId} or o.`customer_id` in(select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and cus.customer_service = #{query.salesmanId} ) or o.`creator` = #{query.creator})
</if>
...
...
@@ -350,56 +545,251 @@
<iftest="query.status != null">
AND o.`status` = #{query.status}
</if>
<iftest="query.salesmanId != null and query.creator">
AND (o.`salesman_id` = #{query.salesmanId} or o.`customer_id` in(select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and cus.customer_service = #{query.salesmanId} ) or o.`creator` = #{query.creator})
</if>
<iftest="query.customsType != null">
AND o.`customs_type` = #{query.customsType}
</if>
<iftest="query.productRecord != null">
AND o.`product_record` = #{query.productRecord}
</if>
<iftest="query.transportId != null">
AND o.`transport_id` = #{query.transportId}
</if>
<iftest="query.warehouseType != null">
AND o.`warehouse_type` = #{query.warehouseType}
<iftest="query.pickState != null">
AND o.`pick_state` = #{query.pickState}
</if>
<iftest="query.warehouseTypes != null and query.warehouseTypes.size()>0">
<iftest="query.pickStateList != null and query.pickStateList.size()>0">
<iftest="query.warehouseTypes != null and query.warehouseTypes.size()==1 ">
<iftest="query.salesmanId != null and query.creator">
AND (o.`salesman_id` = #{query.salesmanId} or o.`customer_id` in(select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and cus.customer_service = #{query.salesmanId} ) or o.`creator` = #{query.creator})
</if>
<iftest="query.customsType != null">
AND o.`customs_type` = #{query.customsType}
</if>
<iftest="query.productRecord != null">
AND o.`product_record` = #{query.productRecord}
</if>
<iftest="query.transportId != null">
AND o.`transport_id` = #{query.transportId}
</if>
<iftest="query.warehouseType != null">
AND o.`warehouse_type` = #{query.warehouseType}
</if>
<iftest="query.warehouseTypes != null and query.warehouseTypes.size()>0">
<iftest="query.warehouseTypes != null and query.warehouseTypes.size()==1 ">
<iftest="query.startWarehouseIds !=null and query.startWarehouseIds.size() > 0 and query.destWarehouseIds !=null and query.destWarehouseIds.size() > 0 ">
...
...
@@ -1677,6 +2067,9 @@
</otherwise>
</choose>
</if>
<iftest="query.inWarehouseState != null">
AND o.`in_warehouse_state` = #{query.inWarehouseState}
</if>
<iftest="query.inWarehouseStateList != null and query.inWarehouseStateList.size()>0">
<iftest="query.inWarehouseStateList != null and query.inWarehouseStateList.size()==1 ">
...
...
@@ -1693,8 +2086,8 @@
</foreach>
</if>
</if>
<iftest="query.inWarehouseState != null">
AND o.`in_warehouse_state` = #{query.inWarehouseState}
<iftest="query.shipmentState != null">
AND o.`shipment_State` = #{query.shipmentState}
</if>
<iftest="query.shipmentStateList != null and query.shipmentStateList.size()>0">
...
...
@@ -1712,8 +2105,22 @@
</foreach>
</if>
</if>
<iftest="query.shipmentState != null">
AND o.`shipment_State` = #{query.shipmentState}
<iftest="query.auditType != null">
<choose>
<whentest="query.auditType != 0">
<choose>
<whentest="query.auditType != -1">
AND o.`audit_type` = #{query.auditType}
</when>
<otherwise>
AND o.`audit_type` != 0
</otherwise>
</choose>
</when>
<otherwise>
AND o.`audit_type` = 0
</otherwise>
</choose>
</if>
<iftest="query.auditTypeList != null and query.auditTypeList.size()>0">
...
...
@@ -1760,24 +2167,6 @@
)
</if>
</if>
<iftest="query.auditType != null">
<choose>
<whentest="query.auditType != 0">
<choose>
<whentest="query.auditType != -1">
AND o.`audit_type` = #{query.auditType}
</when>
<otherwise>
AND o.`audit_type` != 0
</otherwise>
</choose>
</when>
<otherwise>
AND o.`audit_type` = 0
</otherwise>
</choose>
</if>
<iftest="query.salesmanId != null ">
AND (o.`salesman_id` = #{query.salesmanId} or
o.`customer_id` in(
...
...
@@ -2374,21 +2763,84 @@
<iftest="query.status != null">
AND o.`status` = #{query.status}
</if>
<iftest="query.warningOrder != null and query.warningOrder == 1 ">
AND (o.type is null or o.type = '' or NOT FIND_IN_SET(2, o.type))
AND o.`is_cargo_control` = 1
AND o.unload_time is not null
AND ((select IFNULL(sum(p.pick_num), 0) from `ecw_order_cargo_control_pick` p where p.order_id = o.order_id and p.status = 3) < o.`sum_num`
or
DATE_ADD(o.unload_time, INTERVAL (
SELECT
IFNULL(ew_dest.rent_free_days, 0)
FROM
ecw_warehouse_line ewl
JOIN ecw_warehouse ew_dest ON ewl.dest_warehouse_id = ew_dest.id
WHERE ewl.id = o.line_id
) DAY) < now())
<iftest="query.pickState != null">
AND o.`pick_state` = #{query.pickState}
</if>
<iftest="query.pickStateList != null and query.pickStateList.size()>0">
<iftest="query.pickStateList != null and query.pickStateList.size()==1 ">
<iftest="query.auditTypeList != null and query.auditTypeList.size()>0">
<iftest="query.auditTypeList != null and query.auditTypeList.size()==1 ">
...
...
@@ -2489,23 +3012,6 @@
)
</if>
</if>
<iftest="query.auditType != null">
<choose>
<whentest="query.auditType != 0">
<choose>
<whentest="query.auditType != -1">
AND o.`audit_type` = #{query.auditType}
</when>
<otherwise>
AND o.`audit_type` != 0
</otherwise>
</choose>
</when>
<otherwise>
AND o.`audit_type` = 0
</otherwise>
</choose>
</if>
<iftest="query.salesmanId != null ">
AND (o.`salesman_id` = #{query.salesmanId} or o.`customer_id` in(select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and cus.customer_service = #{query.salesmanId} ))
</if>
...
...
@@ -3243,9 +3749,41 @@
<iftest="query.inWarehouseState != null">
AND o.`in_warehouse_state` = #{query.inWarehouseState}
</if>
<iftest="query.inWarehouseStateList != null and query.inWarehouseStateList.size()>0">
<iftest="query.inWarehouseStateList != null and query.inWarehouseStateList.size()==1 ">
AND (o.`salesman_id` = #{query.salesmanId} or o.`customer_id` in(select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and cus.customer_service = #{query.salesmanId} ))
</if>
...
...
@@ -4589,7 +5172,85 @@
<iftest="query.status != null">
AND o.`status` = #{query.status}
</if>
<iftest="query.abnormalState != null">
<iftest="query.pickState != null">
AND o.`pick_state` = #{query.pickState}
</if>
<iftest="query.pickStateList != null and query.pickStateList.size()>0">
<iftest="query.pickStateList != null and query.pickStateList.size()==1 ">
AND (o.`salesman_id` = #{query.salesmanId} or o.`customer_id` in(select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and cus.customer_service = #{query.salesmanId} ))
</if>
...
...
@@ -5146,37 +5884,232 @@
<iftest="query.status != null">
AND o.`status` = #{query.status}
</if>
<iftest="query.beginRucangTime != null and query.endRucangTime != null ">
AND o.order_id in(select distinct wi.order_id from ecw_order_warehouse_in wi where wi.deleted = 0 and
wi.`in_time` between #{query.beginRucangTime} and #{query.endRucangTime})
</if>
<iftest="query.beginQingguanTime != null and query.endQingguanTime != null ">
AND o.`qingguan_time` between #{query.beginQingguanTime} and #{query.endQingguanTime}
</if>
<iftest="query.beginDaogangTime != null and query.endDaogangTime != null ">
AND o.`daogang_time` between #{query.beginDaogangTime} and #{query.endDaogangTime}
</if>
<iftest="query.beginPreLoadTime != null and query.endPreLoadTime != null ">
AND o.`status` > 5 AND o.`pre_load_time` between #{query.beginPreLoadTime} and #{query.endPreLoadTime}
</if>
<iftest="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})
</if>
<iftest="query.beginLoadTime != null and query.endLoadTime != null ">
AND o.`load_time` between #{query.beginLoadTime} and #{query.endLoadTime}
<iftest="query.pickState != null">
AND o.`pick_state` = #{query.pickState}
</if>
<iftest="query.beginUnloadTime != null and query.endUnloadTime != null ">
AND o.`unload_time` between #{query.beginUnloadTime} and #{query.endUnloadTime}
<iftest="query.pickStateList != null and query.pickStateList.size()>0">
<iftest="query.pickStateList != null and query.pickStateList.size()==1 ">