mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1、删除柜体导致的order_goods数量错误修复;2、排单统计小板数量和面积错误修复;3、订单分组按房间柜体获取材质时缺少面积修复;
This commit is contained in:
+1
-1
@@ -1572,7 +1572,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
goodsMapper.updateDeletedById(orderId, goodsIdDeleted, organId);
|
||||
}
|
||||
|
||||
return goodsIdDeleted;
|
||||
return goodsIds.stream().toList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
+14
-21
@@ -201,7 +201,16 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
createPlanAndPlateDataList(grouped, plateItemList, planDOS, processId, processName, loginUser, PlanTypeEnum.ORDERPLAN.getType());
|
||||
}
|
||||
|
||||
// 计算排单的数量和面积
|
||||
if (CollUtil.isNotEmpty(planDOS)) {
|
||||
for (PlanDO planDO : planDOS) {
|
||||
OrderPlanPlateNumAndAreaRespVO orderPlanPlateNumAndAreaRespVO = planItemMapper.selectPlanPlateNumAndArea(planDO.getId());
|
||||
if (ObjectUtil.isNotNull(orderPlanPlateNumAndAreaRespVO)) {
|
||||
planDO.setPlateNum(orderPlanPlateNumAndAreaRespVO.getNum());
|
||||
planDO.setPlateArea(orderPlanPlateNumAndAreaRespVO.getArea());
|
||||
}
|
||||
}
|
||||
}
|
||||
// 增加排单
|
||||
planMapper.insertBatch(planDOS);
|
||||
}
|
||||
@@ -1360,8 +1369,6 @@ public class PlanServiceImpl implements PlanService {
|
||||
for (Map.Entry<Long, List<OrderPlateIds>> entry : groupedPlates.entrySet()) {
|
||||
Long orderGoodsId = entry.getKey();
|
||||
List<OrderPlateIds> plates = entry.getValue();
|
||||
Integer plateNum = 0;
|
||||
BigDecimal area = BigDecimal.ZERO;
|
||||
|
||||
// 查询version
|
||||
GoodsDO goodsDO = goodsMapper.selectById(orderGoodsId);
|
||||
@@ -1391,16 +1398,6 @@ public class PlanServiceImpl implements PlanService {
|
||||
if (update == 0) {
|
||||
throw new ServiceException(ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||
}
|
||||
// 累计板件数量和面积
|
||||
plateNum += goodsPlateNumAndAreaPlanInfoNum;
|
||||
area = area.add(goodsPlateNumAndAreaPlanInfoArea);
|
||||
}
|
||||
if (plateNum != 0) {
|
||||
// 更新排单板件数量和面积
|
||||
planMapper.update(new LambdaUpdateWrapper<PlanDO>()
|
||||
.eq(PlanDO::getId, planId)
|
||||
.set(PlanDO::getPlateNum, plateNum)
|
||||
.set(PlanDO::getPlateArea, area));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1836,7 +1833,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
.build();
|
||||
|
||||
// 更新板件排单id & 统计更新order_goods的数量和面积
|
||||
planDO.setPlateArea(computePlatePlanAndComputeOrderGoodsInfo(planId, goodsPlateIdMap));
|
||||
computePlatePlanAndComputeOrderGoodsInfo(planId, goodsPlateIdMap);
|
||||
planDOS.add(planDO);
|
||||
|
||||
}
|
||||
@@ -1907,7 +1904,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
.build();
|
||||
|
||||
// 更新板件排单id & 统计更新order_goods的数量和面积
|
||||
planDO.setPlateArea(computePlatePlanAndComputeOrderGoodsInfo(planId, goodsPlateIdMap));
|
||||
computePlatePlanAndComputeOrderGoodsInfo(planId, goodsPlateIdMap);
|
||||
planDOS.add(planDO);
|
||||
}
|
||||
// 统计更新orders的小板数量和面积
|
||||
@@ -1920,8 +1917,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
* @param planId
|
||||
* @param goodsPlateIdMap
|
||||
*/
|
||||
public BigDecimal computePlatePlanAndComputeOrderGoodsInfo(Long planId, Map<Long, List<Long>> goodsPlateIdMap) {
|
||||
BigDecimal planArea = BigDecimal.ZERO;
|
||||
public void computePlatePlanAndComputeOrderGoodsInfo(Long planId, Map<Long, List<Long>> goodsPlateIdMap) {
|
||||
for (Map.Entry<Long, List<Long>> entry : goodsPlateIdMap.entrySet()) {
|
||||
Long orderGoodsId = entry.getKey();
|
||||
// 查询version
|
||||
@@ -1942,19 +1938,16 @@ public class PlanServiceImpl implements PlanService {
|
||||
int version = goodsDO.getVersion();
|
||||
// 统计每个order_goods下的未排单面积,更新到order_goods中
|
||||
OrderPlanPlateNumAndAreaRespVO goodsPlateNumAndAreaPlanInfo = goodsMapper.selectPlannedPlateNumAndArea(orderGoodsId);
|
||||
BigDecimal plannedArea = goodsPlateNumAndAreaPlanInfo.getArea();
|
||||
int update = goodsMapper.update(new LambdaUpdateWrapper<GoodsDO>()
|
||||
.eq(GoodsDO::getId, orderGoodsId)
|
||||
.eq(GoodsDO::getVersion, version)
|
||||
.set(GoodsDO::getPlannedPlateArea, plannedArea)
|
||||
.set(GoodsDO::getPlannedPlateArea, goodsPlateNumAndAreaPlanInfo.getArea())
|
||||
.set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum())
|
||||
.set(GoodsDO::getVersion, version + 1));
|
||||
if (update == 0) {
|
||||
throw new ServiceException(ErrorCodeConstants.CREATE_PLAN_GOODS_UPDATE_CONCURRENCY_ERROR, orderGoodsId);
|
||||
}
|
||||
planArea = planArea.add(plannedArea);
|
||||
}
|
||||
return planArea;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+43
-27
@@ -271,37 +271,53 @@
|
||||
|
||||
|
||||
<select id="selectNoPlanGoodsByRoomAndBodyIds" resultMap="OrderGoodsMap" parameterType="java.lang.Long">
|
||||
select
|
||||
og.color,
|
||||
og.goods_name as goodsName,
|
||||
og.material,
|
||||
og.thickness,
|
||||
og.brand,
|
||||
og.texture,
|
||||
SELECT
|
||||
t.color,
|
||||
t.goodsName,
|
||||
t.material,
|
||||
t.thickness,
|
||||
t.brand,
|
||||
t.texture,
|
||||
COUNT(*) AS num,
|
||||
SUM(t.area) AS area
|
||||
|
||||
count(distinct op.id) as num
|
||||
FROM (
|
||||
SELECT DISTINCT
|
||||
op.id,
|
||||
op.area,
|
||||
og.color,
|
||||
og.goods_name AS goodsName,
|
||||
og.material,
|
||||
og.thickness,
|
||||
og.brand,
|
||||
og.texture
|
||||
|
||||
from order_plate op
|
||||
FROM order_plate op
|
||||
|
||||
join order_goods og
|
||||
on og.id = op.goods_id
|
||||
and og.order_id = op.order_id
|
||||
and og.organ_id = op.organ_id
|
||||
JOIN order_goods og
|
||||
ON og.id = op.goods_id
|
||||
AND og.order_id = op.order_id
|
||||
AND og.organ_id = op.organ_id
|
||||
|
||||
join order_item oi
|
||||
on oi.plate_id = op.id
|
||||
and oi.order_id = op.order_id
|
||||
and oi.organ_id = op.organ_id
|
||||
and oi.source_id = 0
|
||||
${ew.customSqlSegment}
|
||||
and op.plan_id = 0
|
||||
group by
|
||||
og.color,
|
||||
og.goods_name,
|
||||
og.material,
|
||||
og.thickness,
|
||||
og.brand,
|
||||
og.texture
|
||||
JOIN order_item oi
|
||||
ON oi.plate_id = op.id
|
||||
AND oi.order_id = op.order_id
|
||||
AND oi.organ_id = op.organ_id
|
||||
AND oi.source_id = 0
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
AND op.plan_id = 0
|
||||
) t
|
||||
|
||||
GROUP BY
|
||||
t.color,
|
||||
t.goodsName,
|
||||
t.material,
|
||||
t.thickness,
|
||||
t.brand,
|
||||
t.texture
|
||||
ORDER BY t.thickness DESC
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user