1. 看板逻辑修改

This commit is contained in:
梁州 2025-04-29 11:13:03 +08:00
parent e49d205deb
commit 5e095d8f74

View File

@ -616,10 +616,14 @@ public class KateWorkQueryController {
}
// 计算需要多少个看板
BigDecimal needKanbanQuantity = targetNum.subtract(remainNum).divide(pullGoods.getQuantityPerKanban(), 0, RoundingMode.CEILING);
if (remainNum.add(needKanbanQuantity.multiply(pullGoods.getQuantityPerKanban())).compareTo(maxNum) > 0) {
while (remainNum.add(needKanbanQuantity.multiply(pullGoods.getQuantityPerKanban())).compareTo(maxNum) > 0) {
// 超过最大容量
needKanbanQuantity = needKanbanQuantity.subtract(BigDecimal.ONE);
}
if (needKanbanQuantity.compareTo(BigDecimal.ZERO) <= 0) {
// 不要补看板
continue;
}
// 看板表中当前物料的所有看板
List<Kanban> kanbanList = kanbanService.list(new LambdaQueryWrapper<Kanban>()
.eq(Kanban::getGoodsId, pullGoods.getGoodsId())
@ -643,8 +647,10 @@ public class KateWorkQueryController {
needKanbanQuantity = needKanbanQuantity.subtract(BigDecimal.ONE);
}
}
// 更新看板表
kanbanService.updateBatchById(dealKanbanList);
if (!dealKanbanList.isEmpty()) {
// 更新看板表
kanbanService.updateBatchById(dealKanbanList);
}
logger.info("生成CLC看板需求成功。");
response.setCode(ResponseCode.OK.getCode());