Commit 68248677 authored by zhengyi's avatar zhengyi

订单列表相关统计业务修正

parent 066fe581
...@@ -7296,10 +7296,33 @@ ...@@ -7296,10 +7296,33 @@
<select id="statisticsMyOrder" resultType="cn.iocoder.yudao.module.order.vo.order.StatisticsOrderVO"> <select id="statisticsMyOrder" resultType="cn.iocoder.yudao.module.order.vo.order.StatisticsOrderVO">
select select
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.cartonsNum'), 0)) as total_num, <choose>
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.volume'), 0)) as total_volume, <when test="query.beginWarehouseInTime != null and query.endWarehouseInTime != null">
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.weight'), 0)) as total_weight, SUM(IFNULL(wi.cartons_num, 0)) as total_num,
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.quantityAll'), 0)) as order_quantity, 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
</when>
<when test="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
</when>
<otherwise>
<choose>
<when test="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->>'$.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,
</otherwise>
</choose>
SUM(IFNULL(it.w_volume,0)) as total_w_volume, SUM(IFNULL(it.w_volume,0)) as total_w_volume,
SUM(IFNULL(it.v_weight,0)) as total_v_weight, SUM(IFNULL(it.v_weight,0)) as total_v_weight,
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_weight > it.min_metering_weight ,it.charge_weight,it.min_metering_weight)), 0)) as total_charge_weight,
...@@ -7313,6 +7336,12 @@ ...@@ -7313,6 +7336,12 @@
left join ecw_order_consignor nor on nor.order_id = o.order_id and nor.deleted = 0 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_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 left join ecw_channel channel on channel.channel_id = o.channel_id
<if test="query.beginWarehouseInTime != null and query.endWarehouseInTime != null ">
left join ecw_order_warehouse_in wi ON wi.order_id = o.order_id and wi.deleted = 0
</if>
<if test="query.beginRucangTime != null and query.endRucangTime != null ">
left join ecw_order_warehouse_in wi ON wi.order_id = o.order_id and wi.deleted = 0
</if>
where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10 where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10
<if test = "query.deptId != null "> <if test = "query.deptId != null ">
AND o.dept_id = #{query.deptId} AND o.dept_id = #{query.deptId}
...@@ -7328,10 +7357,33 @@ ...@@ -7328,10 +7357,33 @@
</select> </select>
<select id="statisticsOrder" resultType="cn.iocoder.yudao.module.order.vo.order.StatisticsOrderVO"> <select id="statisticsOrder" resultType="cn.iocoder.yudao.module.order.vo.order.StatisticsOrderVO">
select select
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.cartonsNum'), 0)) as total_num, <choose>
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.volume'), 0)) as total_volume, <when test="query.beginWarehouseInTime != null and query.endWarehouseInTime != null">
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.weight'), 0)) as total_weight, SUM(IFNULL(wi.cartons_num, 0)) as total_num,
SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.quantityAll'), 0)) as order_quantity, 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
</when>
<when test="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
</when>
<otherwise>
<choose>
<when test="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->>'$.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,
</otherwise>
</choose>
SUM(IFNULL(it.w_volume,0)) as total_w_volume, SUM(IFNULL(it.w_volume,0)) as total_w_volume,
SUM(IFNULL(it.v_weight,0)) as total_v_weight, SUM(IFNULL(it.v_weight,0)) as total_v_weight,
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_weight > it.min_metering_weight ,it.charge_weight,it.min_metering_weight)), 0)) as total_charge_weight,
...@@ -7345,6 +7397,12 @@ ...@@ -7345,6 +7397,12 @@
left join ecw_order_consignor nor on nor.order_id = o.order_id left join ecw_order_consignor nor on nor.order_id = o.order_id
left join ecw_order_consignee nee on nee.order_id = o.order_id 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 left join ecw_channel channel on channel.channel_id = o.channel_id
<if test="query.beginWarehouseInTime != null and query.endWarehouseInTime != null ">
left join ecw_order_warehouse_in wi ON wi.order_id = o.order_id and wi.deleted = 0
</if>
<if test="query.beginRucangTime != null and query.endRucangTime != null ">
left join ecw_order_warehouse_in wi ON wi.order_id = o.order_id and wi.deleted = 0
</if>
where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10 where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10
<if test = "query.deptId != null "> <if test = "query.deptId != null ">
AND o.dept_id = #{query.deptId} AND o.dept_id = #{query.deptId}
...@@ -7366,7 +7424,7 @@ ...@@ -7366,7 +7424,7 @@
SUM(IFNULL(wi.quantity_all, 0)) as order_quantity SUM(IFNULL(wi.quantity_all, 0)) as order_quantity
from ecw_order_warehouse_in wi from ecw_order_warehouse_in wi
left join ecw_order o left join ecw_order o
ON wi.order_id = o.order_id ON wi.order_id = o.order_id and wi.deleted = 0
left join ecw_order_departure de on de.order_id = o.order_id 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 left join ecw_order_objective ob on ob.order_id = o.order_id
left join ecw_order_consignor nor on nor.order_id = o.order_id left join ecw_order_consignor nor on nor.order_id = o.order_id
......
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