<whentest="query.beginWarehouseInTime != null and query.endWarehouseInTime != null">
SUM(IFNULL(wi.cartons_num, 0)) as total_num,
SUM(IFNULL(wi.volume, 0)) as total_volume,
SUM(IFNULL(wi.weight, 0)) as total_weight,
SUM(IFNULL(wi.quantity_all, 0)) as order_quantity,
SUM(IFNULL( win.total_num, 0 )) AS total_num,
SUM(IFNULL( win.total_volume, 0 )) AS total_volume,
SUM(IFNULL( win.total_weight, 0 )) AS total_weight,
SUM(IFNULL( win.order_quantity, 0 )) AS order_quantity,
</when>
<whentest="query.beginRucangTime != null and query.endRucangTime != null">
SUM(IFNULL(wi.cartons_num, 0)) as total_num,
SUM(IFNULL(wi.volume, 0)) as total_volume,
SUM(IFNULL(wi.weight, 0)) as total_weight,
SUM(IFNULL(wi.quantity_all, 0)) as order_quantity,
SUM(IFNULL( win.total_num, 0 )) AS total_num,
SUM(IFNULL( win.total_volume, 0 )) AS total_volume,
SUM(IFNULL( win.total_weight, 0 )) AS total_weight,
SUM(IFNULL( win.order_quantity, 0 )) AS order_quantity,
</when>
<otherwise>
<choose>
<whentest="query.beginPickUpTime != null and query.endPickUpTime != null">
SUM(IFNULL(select SUM(IFNULL(op.pick_num, 0)) from ecw_order_pickup op where op.order_id = o.order_no and op.deleted = 0, 0)) as total_num,
</when>
<otherwise>
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.cartonsNum'), 0)) as total_num,
</otherwise>
</choose>
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.cartonsNum'), 0)) as total_num,
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.volume'), 0)) as total_volume,
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.weight'), 0)) as total_weight,
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.quantityAll'), 0)) as order_quantity,
...
...
@@ -7396,8 +7389,8 @@
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, IF(it.charge_weight > it.min_metering_weight ,it.charge_weight,it.min_metering_weight)), 0)) as total_charge_weight,
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, IF(it.charge_volume > it.min_metering_volume,it.charge_volume,it.min_metering_volume)), 0)) as total_charge_volume,
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, IF(it.charge_quantity > it.min_metering_quantity,it.charge_quantity,it.min_metering_quantity)), 0)) as total_charge_quantity
from ecw_order_item it
left join ecw_order o
from ecw_order o
left join ecw_order_item it
ON it.order_id = o.order_id and it.deleted = 0
left join ecw_order_departure de on de.order_id = o.order_id
left join ecw_order_objective ob on ob.order_id = o.order_id
...
...
@@ -7405,11 +7398,41 @@
left join ecw_order_consignee nee on nee.order_id = o.order_id and nee.deleted = 0
left join ecw_channel channel on channel.channel_id = o.channel_id
<iftest="query.beginWarehouseInTime != null and query.endWarehouseInTime != null ">
left join ecw_order_warehouse_in wi ON wi.order_item_id = it.order_item_id and wi.deleted = 0
</if>
<iftest="query.beginRucangTime != null and query.endRucangTime != null ">
left join ecw_order_warehouse_in wi ON wi.order_item_id = it.order_item_id and wi.deleted = 0
</if>
left join (
SELECT
wi.order_item_id,
SUM(
IFNULL( wi.cartons_num, 0 )) AS total_num,
SUM(
IFNULL( wi.volume, 0 )) AS total_volume,
SUM(
IFNULL( wi.weight, 0 )) AS total_weight,
SUM(
IFNULL( wi.quantity_all, 0 )) AS order_quantity
FROM ecw_order_warehouse_in wi
WHERE wi.deleted = 0
AND wi.`update_time` BETWEEN #{query.beginWarehouseInTime} and #{query.endWarehouseInTime}
GROUP BY wi.order_item_id
) win ON win.order_item_id = it.order_item_id
</if>
<iftest="query.beginRucangTime != null and query.endRucangTime != null ">
left join (
SELECT
wi.order_item_id,
SUM(
IFNULL( wi.cartons_num, 0 )) AS total_num,
SUM(
IFNULL( wi.volume, 0 )) AS total_volume,
SUM(
IFNULL( wi.weight, 0 )) AS total_weight,
SUM(
IFNULL( wi.quantity_all, 0 )) AS order_quantity
FROM ecw_order_warehouse_in wi
WHERE wi.deleted = 0
AND wi.`in_time` BETWEEN #{query.beginRucangTime} and #{query.endRucangTime}
GROUP BY wi.order_item_id
) win ON win.order_item_id = it.order_item_id
</if>
where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10
<iftest ="query.deptId != null ">
AND o.dept_id = #{query.deptId}
...
...
@@ -7427,26 +7450,19 @@
select
<choose>
<whentest="query.beginWarehouseInTime != null and query.endWarehouseInTime != null">
SUM(IFNULL(wi.cartons_num, 0)) as total_num,
SUM(IFNULL(wi.volume, 0)) as total_volume,
SUM(IFNULL(wi.weight, 0)) as total_weight,
SUM(IFNULL(wi.quantity_all, 0)) as order_quantity,
SUM(IFNULL( win.total_num, 0 )) AS total_num,
SUM(IFNULL( win.total_volume, 0 )) AS total_volume,
SUM(IFNULL( win.total_weight, 0 )) AS total_weight,
SUM(IFNULL( win.order_quantity, 0 )) AS order_quantity,
</when>
<whentest="query.beginRucangTime != null and query.endRucangTime != null">
SUM(IFNULL(wi.cartons_num, 0)) as total_num,
SUM(IFNULL(wi.volume, 0)) as total_volume,
SUM(IFNULL(wi.weight, 0)) as total_weight,
SUM(IFNULL(wi.quantity_all, 0)) as order_quantity,
SUM(IFNULL( win.total_num, 0 )) AS total_num,
SUM(IFNULL( win.total_volume, 0 )) AS total_volume,
SUM(IFNULL( win.total_weight, 0 )) AS total_weight,
SUM(IFNULL( win.order_quantity, 0 )) AS order_quantity,
</when>
<otherwise>
<choose>
<whentest="query.beginPickUpTime != null and query.endPickUpTime != null">
SUM(IFNULL(select SUM(IFNULL(op.pick_num, 0)) from ecw_order_pickup op where op.order_id = o.order_no and op.deleted = 0, 0)) as total_num,
</when>
<otherwise>
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.cartonsNum'), 0)) as total_num,
</otherwise>
</choose>
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.cartonsNum'), 0)) as total_num,
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.volume'), 0)) as total_volume,
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.weight'), 0)) as total_weight,
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.quantityAll'), 0)) as order_quantity,
...
...
@@ -7457,8 +7473,8 @@
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, IF(it.charge_weight > it.min_metering_weight ,it.charge_weight,it.min_metering_weight)), 0)) as total_charge_weight,
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, IF(it.charge_volume > it.min_metering_volume,it.charge_volume,it.min_metering_volume)), 0)) as total_charge_volume,
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, IF(it.charge_quantity > it.min_metering_quantity,it.charge_quantity,it.min_metering_quantity)), 0)) as total_charge_quantity
from ecw_order_item it
left join ecw_order o
from ecw_order o
left join ecw_order_item it
ON it.order_id = o.order_id and it.deleted = 0
left join ecw_order_departure de on de.order_id = o.order_id
left join ecw_order_objective ob on ob.order_id = o.order_id
...
...
@@ -7466,10 +7482,40 @@
left join ecw_order_consignee nee on nee.order_id = o.order_id
left join ecw_channel channel on channel.channel_id = o.channel_id
<iftest="query.beginWarehouseInTime != null and query.endWarehouseInTime != null ">
left join ecw_order_warehouse_in wi ON wi.order_item_id = it.order_item_id and wi.deleted = 0
left join (
SELECT
wi.order_item_id,
SUM(
IFNULL( wi.cartons_num, 0 )) AS total_num,
SUM(
IFNULL( wi.volume, 0 )) AS total_volume,
SUM(
IFNULL( wi.weight, 0 )) AS total_weight,
SUM(
IFNULL( wi.quantity_all, 0 )) AS order_quantity
FROM ecw_order_warehouse_in wi
WHERE wi.deleted = 0
AND wi.`update_time` BETWEEN #{query.beginWarehouseInTime} and #{query.endWarehouseInTime}
GROUP BY wi.order_item_id
) win ON win.order_item_id = it.order_item_id
</if>
<iftest="query.beginRucangTime != null and query.endRucangTime != null ">
left join ecw_order_warehouse_in wi ON wi.order_item_id = it.order_item_id and wi.deleted = 0
left join (
SELECT
wi.order_item_id,
SUM(
IFNULL( wi.cartons_num, 0 )) AS total_num,
SUM(
IFNULL( wi.volume, 0 )) AS total_volume,
SUM(
IFNULL( wi.weight, 0 )) AS total_weight,
SUM(
IFNULL( wi.quantity_all, 0 )) AS order_quantity
FROM ecw_order_warehouse_in wi
WHERE wi.deleted = 0
AND wi.`in_time` BETWEEN #{query.beginRucangTime} and #{query.endRucangTime}
GROUP BY wi.order_item_id
) win ON win.order_item_id = it.order_item_id
</if>
where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10