新火炬后端单体项目初始化代码
zhangherong
3 天以前 d4a7b1faad635b4817891185a4f471595db2eece
src/main/java/org/jeecg/modules/cms/controller/CuttingReceiveController.java
@@ -103,7 +103,7 @@
            temp.setOrderId(cuttingReceive.getId());
            cuttingReceiveDetailService.save(temp);
        }
        // 更新库存刀具状态为"已出库"
        // 更新库存刀具状态为"待出库"
        if (!list.isEmpty()) {
            // 收集所有需要更新状态的库存ID
            List<String> inventoryIds = list.stream()
@@ -112,7 +112,7 @@
                    .collect(Collectors.toList());
            if (!inventoryIds.isEmpty()) {
                // 更新库存状态为"已出库"
                // 更新库存状态为"待出库"
                cuttingInventoryService.updateStatus(inventoryIds, "待出库");
            }
        }
@@ -140,7 +140,25 @@
    //@RequiresPermissions("org.jeecg.modules:cms_cutting_receive:delete")
    @DeleteMapping(value = "/delete")
    public Result<String> delete(@RequestParam(name = "id") String id) {
        // 先查询出领用单明细,获取相关的库存ID
        List<CuttingReceiveDetail> detailList = cuttingReceiveDetailService.lambdaQuery()
                .eq(CuttingReceiveDetail::getOrderId, id)
                .list();
        // 删除领用单主表和明细表数据
        cuttingReceiveService.removeById(id);
        cuttingReceiveDetailService.removeById(id);
        // 获取库存ID列表
        List<String> inventoryIds = detailList.stream()
                .map(CuttingReceiveDetail::getInventoryId)
                .filter(Objects::nonNull)
                .collect(Collectors.toList());
        // 将相关刀具库存状态改回之前的状态
        if (!inventoryIds.isEmpty()) {
            cuttingInventoryService.restoreStatus(inventoryIds);
        }
        return Result.OK("删除成功!");
    }
@@ -153,6 +171,7 @@
    @DeleteMapping(value = "/deleteBatch")
    public Result<String> deleteBatch(@RequestParam(name = "ids") String ids) {
        this.cuttingReceiveService.removeByIds(Arrays.asList(ids.split(",")));
        //FIXME: 批量删除时,库存状态未恢复。也需要批量恢复库存状态。
        return Result.OK("批量删除成功!");
    }
@@ -214,7 +233,6 @@
        return cuttingReceiveService.submit(orderId);
    }
    //TODO: @GetMapping("/handleBack")
    @GetMapping("/handleBack")
    public Result<?> handleBack(@RequestParam("orderId") String orderId) {
        return cuttingReceiveService.handleBack(orderId);