Commit 68248677 authored by zhengyi's avatar zhengyi

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

parent 066fe581
......@@ -1675,45 +1675,45 @@ public class OrderQueryServiceImpl implements OrderQueryService {
} else {
vo = new StatisticsOrderVO();
}
if (Objects.nonNull(query.getBeginWarehouseInTime()) && Objects.nonNull(query.getEndWarehouseInTime())) {
// 入仓记录统计时,实测入仓数据替换为入仓记录中的和值
StatisticsOrderVO warehouseInVO = orderMapper.statisticsWarehouseIn(query);
if (Objects.nonNull(warehouseInVO)) {
vo.setTotalNum(warehouseInVO.getTotalNum());
vo.setTotalVolume(new BigDecimal(warehouseInVO.getTotalVolume()).setScale(2, RoundingMode.HALF_UP).toString());
vo.setTotalWeight(new BigDecimal(warehouseInVO.getTotalWeight()).setScale(2, RoundingMode.HALF_UP).toString());
vo.setOrderQuantity(warehouseInVO.getOrderQuantity());
} else {
vo.setTotalNum(0);
vo.setTotalVolume(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
vo.setTotalWeight(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
vo.setOrderQuantity(0);
}
}
if (Objects.nonNull(query.getBeginRucangTime()) && Objects.nonNull(query.getEndRucangTime())) {
// 入仓记录统计时,实测入仓数据替换为入仓记录中的和值
StatisticsOrderVO warehouseInVO = orderMapper.statisticsWarehouseIn(query);
if (Objects.nonNull(warehouseInVO)) {
vo.setTotalNum(warehouseInVO.getTotalNum());
vo.setTotalVolume(new BigDecimal(warehouseInVO.getTotalVolume()).setScale(2, RoundingMode.HALF_UP).toString());
vo.setTotalWeight(new BigDecimal(warehouseInVO.getTotalWeight()).setScale(2, RoundingMode.HALF_UP).toString());
vo.setOrderQuantity(warehouseInVO.getOrderQuantity());
} else {
vo.setTotalNum(0);
vo.setTotalVolume(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
vo.setTotalWeight(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
vo.setOrderQuantity(0);
}
}
if (Objects.nonNull(query.getBeginPickUpTime()) && Objects.nonNull(query.getEndPickUpTime())) {
// 入仓记录统计时,实测入仓数据替换为入仓记录中的和值
StatisticsOrderVO pickUpVO = orderMapper.statisticsPickUp(query);
if (Objects.nonNull(pickUpVO)) {
vo.setTotalNum(pickUpVO.getTotalNum());
} else {
vo.setTotalNum(0);
}
}
// if (Objects.nonNull(query.getBeginWarehouseInTime()) && Objects.nonNull(query.getEndWarehouseInTime())) {
// // 入仓记录统计时,实测入仓数据替换为入仓记录中的和值
// StatisticsOrderVO warehouseInVO = orderMapper.statisticsWarehouseIn(query);
// if (Objects.nonNull(warehouseInVO)) {
// vo.setTotalNum(warehouseInVO.getTotalNum());
// vo.setTotalVolume(new BigDecimal(warehouseInVO.getTotalVolume()).setScale(2, RoundingMode.HALF_UP).toString());
// vo.setTotalWeight(new BigDecimal(warehouseInVO.getTotalWeight()).setScale(2, RoundingMode.HALF_UP).toString());
// vo.setOrderQuantity(warehouseInVO.getOrderQuantity());
// } else {
// vo.setTotalNum(0);
// vo.setTotalVolume(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
// vo.setTotalWeight(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
// vo.setOrderQuantity(0);
// }
// }
// if (Objects.nonNull(query.getBeginRucangTime()) && Objects.nonNull(query.getEndRucangTime())) {
// // 入仓记录统计时,实测入仓数据替换为入仓记录中的和值
// StatisticsOrderVO warehouseInVO = orderMapper.statisticsWarehouseIn(query);
// if (Objects.nonNull(warehouseInVO)) {
// vo.setTotalNum(warehouseInVO.getTotalNum());
// vo.setTotalVolume(new BigDecimal(warehouseInVO.getTotalVolume()).setScale(2, RoundingMode.HALF_UP).toString());
// vo.setTotalWeight(new BigDecimal(warehouseInVO.getTotalWeight()).setScale(2, RoundingMode.HALF_UP).toString());
// vo.setOrderQuantity(warehouseInVO.getOrderQuantity());
// } else {
// vo.setTotalNum(0);
// vo.setTotalVolume(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
// vo.setTotalWeight(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
// vo.setOrderQuantity(0);
// }
// }
// if (Objects.nonNull(query.getBeginPickUpTime()) && Objects.nonNull(query.getEndPickUpTime())) {
// // 入仓记录统计时,实测入仓数据替换为入仓记录中的和值
// StatisticsOrderVO pickUpVO = orderMapper.statisticsPickUp(query);
// if (Objects.nonNull(pickUpVO)) {
// vo.setTotalNum(pickUpVO.getTotalNum());
// } else {
// vo.setTotalNum(0);
// }
// }
return vo;
}
......@@ -1730,46 +1730,46 @@ public class OrderQueryServiceImpl implements OrderQueryService {
} else {
vo = new StatisticsOrderVO();
}
if (Objects.nonNull(query.getBeginWarehouseInTime()) && Objects.nonNull(query.getEndWarehouseInTime())) {
// 入仓记录统计时,实测入仓数据替换为入仓记录中的和值
StatisticsOrderVO warehouseInVO = orderMapper.statisticsMyWarehouseIn(query);
if (Objects.nonNull(warehouseInVO)) {
vo.setTotalNum(warehouseInVO.getTotalNum());
vo.setTotalVolume(new BigDecimal(warehouseInVO.getTotalVolume()).setScale(2, RoundingMode.HALF_UP).toString());
vo.setTotalWeight(new BigDecimal(warehouseInVO.getTotalWeight()).setScale(2, RoundingMode.HALF_UP).toString());
vo.setOrderQuantity(warehouseInVO.getOrderQuantity());
} else {
vo.setTotalNum(0);
vo.setTotalVolume(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
vo.setTotalWeight(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
vo.setOrderQuantity(0);
}
}
if (Objects.nonNull(query.getBeginRucangTime()) && Objects.nonNull(query.getEndRucangTime())) {
// 入仓记录统计时,实测入仓数据替换为入仓记录中的和值
StatisticsOrderVO warehouseInVO = orderMapper.statisticsMyWarehouseIn(query);
if (Objects.nonNull(warehouseInVO)) {
vo.setTotalNum(warehouseInVO.getTotalNum());
vo.setTotalVolume(new BigDecimal(warehouseInVO.getTotalVolume()).setScale(2, RoundingMode.HALF_UP).toString());
vo.setTotalWeight(new BigDecimal(warehouseInVO.getTotalWeight()).setScale(2, RoundingMode.HALF_UP).toString());
vo.setOrderQuantity(warehouseInVO.getOrderQuantity());
} else {
vo.setTotalNum(0);
vo.setTotalVolume(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
vo.setTotalWeight(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
vo.setOrderQuantity(0);
}
}
if (Objects.nonNull(query.getBeginPickUpTime()) &&
Objects.nonNull(query.getEndPickUpTime())) {
// 入仓记录统计时,实测入仓数据替换为入仓记录中的和值
StatisticsOrderVO pickUpVO = orderMapper.statisticsMyPickUp(query);
if (Objects.nonNull(pickUpVO)) {
vo.setTotalNum(pickUpVO.getTotalNum());
} else {
vo.setTotalNum(0);
}
}
// if (Objects.nonNull(query.getBeginWarehouseInTime()) && Objects.nonNull(query.getEndWarehouseInTime())) {
// // 入仓记录统计时,实测入仓数据替换为入仓记录中的和值
// StatisticsOrderVO warehouseInVO = orderMapper.statisticsWarehouseIn(query);
// if (Objects.nonNull(warehouseInVO)) {
// vo.setTotalNum(warehouseInVO.getTotalNum());
// vo.setTotalVolume(new BigDecimal(warehouseInVO.getTotalVolume()).setScale(2, RoundingMode.HALF_UP).toString());
// vo.setTotalWeight(new BigDecimal(warehouseInVO.getTotalWeight()).setScale(2, RoundingMode.HALF_UP).toString());
// vo.setOrderQuantity(warehouseInVO.getOrderQuantity());
// } else {
// vo.setTotalNum(0);
// vo.setTotalVolume(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
// vo.setTotalWeight(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
// vo.setOrderQuantity(0);
// }
// }
// if (Objects.nonNull(query.getBeginRucangTime()) && Objects.nonNull(query.getEndRucangTime())) {
// // 入仓记录统计时,实测入仓数据替换为入仓记录中的和值
// StatisticsOrderVO warehouseInVO = orderMapper.statisticsMyWarehouseIn(query);
// if (Objects.nonNull(warehouseInVO)) {
// vo.setTotalNum(warehouseInVO.getTotalNum());
// vo.setTotalVolume(new BigDecimal(warehouseInVO.getTotalVolume()).setScale(2, RoundingMode.HALF_UP).toString());
// vo.setTotalWeight(new BigDecimal(warehouseInVO.getTotalWeight()).setScale(2, RoundingMode.HALF_UP).toString());
// vo.setOrderQuantity(warehouseInVO.getOrderQuantity());
// } else {
// vo.setTotalNum(0);
// vo.setTotalVolume(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
// vo.setTotalWeight(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
// vo.setOrderQuantity(0);
// }
// }
// if (Objects.nonNull(query.getBeginPickUpTime()) &&
// Objects.nonNull(query.getEndPickUpTime())) {
// // 提货记录统计时,实测入仓数据替换为提货记录中的和值
// StatisticsOrderVO pickUpVO = orderMapper.statisticsMyPickUp(query);
// if (Objects.nonNull(pickUpVO)) {
// vo.setTotalNum(pickUpVO.getTotalNum());
// } else {
// vo.setTotalNum(0);
// }
// }
return vo;
}
......
......@@ -7296,10 +7296,33 @@
<select id="statisticsMyOrder" resultType="cn.iocoder.yudao.module.order.vo.order.StatisticsOrderVO">
select
<choose>
<when test="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
</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.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,
......@@ -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_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
<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
<if test = "query.deptId != null ">
AND o.dept_id = #{query.deptId}
......@@ -7328,10 +7357,33 @@
</select>
<select id="statisticsOrder" resultType="cn.iocoder.yudao.module.order.vo.order.StatisticsOrderVO">
select
<choose>
<when test="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
</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.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,
......@@ -7345,6 +7397,12 @@
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_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
<if test = "query.deptId != null ">
AND o.dept_id = #{query.deptId}
......@@ -7366,7 +7424,7 @@
SUM(IFNULL(wi.quantity_all, 0)) as order_quantity
from ecw_order_warehouse_in wi
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_objective ob on ob.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