mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
禅道bug#1616修复
This commit is contained in:
+9
@@ -215,4 +215,13 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
* @return
|
||||
*/
|
||||
List<OrderGoodsPlateNumAndAreaDO> selectPlateNumAndArea(@Param("orderGoodsIds") Collection<Long> orderGoodsIds, @Param("delete") Boolean delete);
|
||||
|
||||
/**
|
||||
* 根据板材id和订单id查询父订单id
|
||||
*
|
||||
* @param goodsId
|
||||
* @param orderIds
|
||||
* @return
|
||||
*/
|
||||
List<Long> getParentOrderIdsByGoodsIds(@Param("goodsIds") List<String> goodsId, @Param("orderIds") List<Long> orderIds);
|
||||
}
|
||||
+14
-7
@@ -58,6 +58,7 @@ import com.cf.imes.module.executor.dal.mysql.remainplaten.RemainPlateMapper;
|
||||
import com.cf.imes.module.executor.enums.ErrorCodeConstants;
|
||||
import com.cf.imes.module.executor.enums.OrderPlanQueryTypeEnum;
|
||||
import com.cf.imes.module.executor.enums.OrderStatusEnum;
|
||||
import com.cf.imes.module.executor.service.order.OrderService;
|
||||
import com.cf.imes.module.executor.util.elasticsearch.EsUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -132,6 +133,8 @@ public class PlanServiceImpl implements PlanService {
|
||||
@Resource
|
||||
private OrderComponentMapper orderComponentMapper;
|
||||
|
||||
@Resource
|
||||
private OrderService orderService;
|
||||
|
||||
// 重复使用的常量
|
||||
private static final String FIELD_ORDER_ID = "o.id";
|
||||
@@ -530,18 +533,22 @@ public class PlanServiceImpl implements PlanService {
|
||||
statusList.add(OrderStatusEnum.IN_PRODUCTION.getStatus());
|
||||
statusList.add(OrderStatusEnum.SORTED.getStatus());
|
||||
|
||||
List<String> goodsId = Optional.ofNullable(pageReqVO.getGoodsIds()).orElse(new ArrayList<>());
|
||||
List<String> goodsIds = Optional.ofNullable(pageReqVO.getGoodsIds()).orElse(new ArrayList<>());
|
||||
|
||||
List<Long> orderGoodsIds = new ArrayList<>();
|
||||
// 查询类型:订单分组
|
||||
int type = OrderPlanQueryTypeEnum.ORDER_GROUP.getType();
|
||||
if(CollUtil.isNotEmpty(goodsId)) {
|
||||
if(CollUtil.isNotEmpty(goodsIds)) {
|
||||
// 从订单材质查询订单id列表
|
||||
List<Long> goodsOrderId =
|
||||
goodsMapper.getParentOrderIdsByGoodsIds(
|
||||
goodsIds,
|
||||
pageReqVO.getOrderIds());
|
||||
|
||||
List<Long> orderIdList = Optional.ofNullable(pageReqVO.getOrderIds()).orElse(new ArrayList<>());
|
||||
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectListByGoodsId(orderIdList, goodsId, organId);
|
||||
orderGoodsIds.addAll(goodsDOS.stream().map(GoodsDO::getId).toList());
|
||||
type = OrderPlanQueryTypeEnum.GOODS_GROUP.getType();
|
||||
if (CollUtil.isNotEmpty(goodsOrderId)) {
|
||||
// 查询本身和父订单id
|
||||
pageReqVO.setOrderIds(orderService.getFatherAndSonOrderIds(goodsOrderId));
|
||||
}
|
||||
}
|
||||
|
||||
QueryWrapperX<OrderDO> queryWrapperX = new QueryWrapperX<>();
|
||||
|
||||
+33
@@ -589,4 +589,37 @@
|
||||
GROUP BY op.goods_id
|
||||
</select>
|
||||
|
||||
<select id="getParentOrderIdsByGoodsIds" resultType="java.lang.Long">
|
||||
SELECT DISTINCT o.id
|
||||
FROM order_goods og
|
||||
JOIN orders o
|
||||
ON o.id = og.order_id
|
||||
|
||||
WHERE og.plate_num - og.planned_plate_num > 0
|
||||
|
||||
<if test="goodsIds != null and goodsIds.size() > 0">
|
||||
AND og.goods_id IN
|
||||
<foreach collection="goodsIds"
|
||||
item="goodsId"
|
||||
open="("
|
||||
separator=","
|
||||
close=")">
|
||||
#{goodsId}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="orderIds != null and orderIds.size() > 0">
|
||||
AND og.order_id IN
|
||||
<foreach collection="orderIds"
|
||||
item="orderId"
|
||||
open="("
|
||||
separator=","
|
||||
close=")">
|
||||
#{orderId}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
-35
@@ -28,11 +28,6 @@
|
||||
o.area - o.planned_plate_area AS area,
|
||||
</if>
|
||||
|
||||
<if test="type != null and type == @com.cf.imes.module.executor.enums.OrderPlanQueryTypeEnum@GOODS_GROUP.getType()">
|
||||
t.num,
|
||||
t.area,
|
||||
</if>
|
||||
|
||||
o.parent_id AS parentId,
|
||||
o.order_type AS orderType,
|
||||
o.order_date AS orderDate,
|
||||
@@ -44,34 +39,6 @@
|
||||
|
||||
FROM orders o
|
||||
|
||||
<if test="type != null and type == @com.cf.imes.module.executor.enums.OrderPlanQueryTypeEnum@GOODS_GROUP.getType()">
|
||||
|
||||
JOIN (
|
||||
SELECT
|
||||
og.order_id,
|
||||
SUM(og.plate_num - og.planned_plate_num) AS num,
|
||||
SUM(og.area - og.planned_plate_area) AS area
|
||||
FROM order_goods og
|
||||
|
||||
WHERE og.plate_num - og.planned_plate_num > 0
|
||||
|
||||
<if test="orderGoodsIds != null and orderGoodsIds.size() > 0">
|
||||
AND og.id IN
|
||||
<foreach item="orderGoodsId"
|
||||
collection="orderGoodsIds"
|
||||
open="("
|
||||
separator=","
|
||||
close=")">
|
||||
#{orderGoodsId}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
GROUP BY og.order_id
|
||||
|
||||
) t ON t.order_id = o.id
|
||||
|
||||
</if>
|
||||
|
||||
JOIN (
|
||||
|
||||
SELECT
|
||||
@@ -111,8 +78,6 @@
|
||||
|
||||
WHERE o.parent_id = 0
|
||||
|
||||
AND IFNULL(o.plate_num,0) - IFNULL(o.planned_plate_num,0) > 0
|
||||
|
||||
ORDER BY o.id DESC
|
||||
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user