mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
新增已排订单带实际排单板材信息
This commit is contained in:
+4
-1
@@ -57,9 +57,12 @@ public class PlanRespVO {
|
||||
@Schema(description = "排单对应的订单的信息", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<PlanOrderRespVO> orderList;
|
||||
|
||||
@Schema(description = "板材信息列表-大板信息", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(description = "板材信息列表-拆单大板信息", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<PlateInfoVO> plateInfoList;
|
||||
|
||||
@Schema(description = "混单实际选择大板信息")
|
||||
private PlateInfoVO actualPlanGoodsInfo;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
+14
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.module.executor.dal.mysql.plate;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.cf.imes.framework.common.enums.DeletedCodeEnum;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
@@ -184,4 +185,17 @@ public interface PlateGoodMapper extends BaseMapperX<PlateGoodDO> {
|
||||
* @return
|
||||
*/
|
||||
List<LinkedHashMap<String, Object>> getOrgAttrGroup(@Param("organId") Long organId);
|
||||
|
||||
|
||||
/**
|
||||
* 根据商品编号查询板材信息
|
||||
*
|
||||
* @param goodsIdList
|
||||
* @return
|
||||
*/
|
||||
default List<PlateGoodDO> selectGoodsListByGoodsId(@Param("goodsIds") List<String> goodsIdList) {
|
||||
return selectList(new LambdaQueryWrapperX<PlateGoodDO>()
|
||||
.eq(PlateGoodDO::getDeleted, DeletedCodeEnum.NOT_DELETED.getStatus())
|
||||
.in(PlateGoodDO::getGoodsId, goodsIdList));
|
||||
}
|
||||
}
|
||||
|
||||
+60
-3
@@ -43,6 +43,7 @@ import com.cf.imes.module.executor.dal.dataobject.ordercomponent.OrderComponentD
|
||||
import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.planitem.PlanItemDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateGoodDO;
|
||||
import com.cf.imes.module.executor.dal.mysql.goods.GoodsMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.order.OrderMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderBody.OrderBodyMapper;
|
||||
@@ -51,6 +52,7 @@ import com.cf.imes.module.executor.dal.mysql.orderItem.OrderItemMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.ordercomponent.OrderComponentMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.plan.PlanMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.planitem.PlanItemMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.plate.PlateGoodMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.remainplaten.RemainPlateMapper;
|
||||
import com.cf.imes.module.executor.enums.ErrorCodeConstants;
|
||||
@@ -94,6 +96,9 @@ public class PlanServiceImpl implements PlanService {
|
||||
@Resource
|
||||
private GoodsMapper goodsMapper;
|
||||
|
||||
@Resource
|
||||
private PlateGoodMapper plateGoodMapper;
|
||||
|
||||
@Resource
|
||||
private PlanItemMapper planItemMapper;
|
||||
|
||||
@@ -401,7 +406,38 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
}
|
||||
|
||||
List<Long> planIds = planDOPageResult.getRecords().stream().map(PlanDO::getId).toList();
|
||||
|
||||
List<PlanDO> records = planDOPageResult.getRecords();
|
||||
|
||||
// planId:goodsDO的对应关系
|
||||
Map<Long, PlateGoodDO> planGoodsMap = new HashMap<>();
|
||||
|
||||
List<PlanDO> mixedPlans = records.stream()
|
||||
.filter(p -> ObjectUtil.equals(PlanTypeEnum.MIXEDORDERPLAN.getType(), p.getType()))
|
||||
.toList();
|
||||
|
||||
if (CollUtil.isNotEmpty(mixedPlans)) {
|
||||
|
||||
List<String> goodsIds = mixedPlans.stream()
|
||||
.map(PlanDO::getGoodsId)
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
// 查询需要的板材信息
|
||||
List<PlateGoodDO> goodsDOS = plateGoodMapper.selectGoodsListByGoodsId(goodsIds);
|
||||
|
||||
Map<String, PlateGoodDO> goodsMap = goodsDOS.stream()
|
||||
.collect(Collectors.toMap(
|
||||
PlateGoodDO::getGoodsId,
|
||||
Function.identity()
|
||||
));
|
||||
|
||||
for (PlanDO plan : mixedPlans) {
|
||||
planGoodsMap.put(plan.getId(), goodsMap.get(plan.getGoodsId()));
|
||||
}
|
||||
}
|
||||
|
||||
List<Long> planIds = records.stream().map(PlanDO::getId).toList();
|
||||
|
||||
|
||||
// 查询排单对应的大板板材信息以及 统计小板数量和面积
|
||||
@@ -411,12 +447,14 @@ public class PlanServiceImpl implements PlanService {
|
||||
List<PlanOrderRespVO> planOrderRespVOS = orderMapper.selectPlanOrderList(planIds, getUserOrganId());
|
||||
|
||||
|
||||
List<PlanRespVO> planRespVOPageResult = BeanUtils.toBean(planDOPageResult.getRecords(), PlanRespVO.class);
|
||||
List<PlanRespVO> planRespVOPageResult = BeanUtils.toBean(records, PlanRespVO.class);
|
||||
|
||||
|
||||
planRespVOPageResult.forEach(e -> {
|
||||
// 大板信息列表
|
||||
// 拆单大板信息列表
|
||||
e.setPlateInfoList(getPlateInfoList(e.getId(), plateInfoVOS));
|
||||
// 混单实际选择大板信息列表
|
||||
getMixedPlanGoodsInfo(e, planGoodsMap);
|
||||
// 未优化小板数量
|
||||
e.setUnOptimizePlateCount(e.getPlateNum() - e.getOptimizedPlateNum());
|
||||
// 订单信息
|
||||
@@ -1111,6 +1149,25 @@ public class PlanServiceImpl implements PlanService {
|
||||
return planDOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置混单的实际排单选择大板信息
|
||||
*
|
||||
* @param planRespVO
|
||||
* @param planGoodsMap
|
||||
*/
|
||||
private void getMixedPlanGoodsInfo(PlanRespVO planRespVO, Map<Long, PlateGoodDO> planGoodsMap) {
|
||||
if (ObjectUtil.equals(planRespVO.getType(), PlanTypeEnum.MIXEDORDERPLAN.getType())) {
|
||||
PlateInfoVO actualPlateInfoVO = new PlateInfoVO();
|
||||
PlateGoodDO goodsDO = planGoodsMap.get(planRespVO.getId());
|
||||
if (ObjectUtil.isNotNull(goodsDO)) {
|
||||
actualPlateInfoVO.setMaterial(goodsDO.getMaterial());
|
||||
actualPlateInfoVO.setColor(goodsDO.getColor());
|
||||
actualPlateInfoVO.setThickness(BigDecimal.valueOf(goodsDO.getThickness()));
|
||||
planRespVO.setActualPlanGoodsInfo(actualPlateInfoVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 板材信息列表
|
||||
private List<PlateInfoVO> getPlateInfoList(Long planId, List<PlateInfoVO> infoVOList) {
|
||||
return infoVOList.stream()
|
||||
|
||||
+3
-11
@@ -203,16 +203,11 @@
|
||||
|
||||
<select id="selectOrderPlanPlateList" resultMap="GoodsListMap" parameterType="java.lang.Long">
|
||||
|
||||
select
|
||||
select distinct
|
||||
op.plan_id as planId,
|
||||
og.width as width,
|
||||
og.height as height,
|
||||
og.material as material,
|
||||
og.thickness as thickness ,
|
||||
og.color as color,
|
||||
og.brand as brand,
|
||||
COUNT(op.id) AS count,
|
||||
SUM(op.area) AS area
|
||||
og.color as color
|
||||
|
||||
from order_plate op
|
||||
join order_goods og on op.organ_id = og.organ_id and op.goods_id = og.id
|
||||
@@ -224,12 +219,9 @@
|
||||
</foreach>
|
||||
GROUP BY
|
||||
planId,
|
||||
width,
|
||||
height,
|
||||
material,
|
||||
thickness,
|
||||
color,
|
||||
brand
|
||||
color
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user