| | |
| | | temp.setOrderId(cuttingReceive.getId()); |
| | | cuttingReceiveDetailService.save(temp); |
| | | } |
| | | // 更新库存刀具状态为"已出库" |
| | | // 更新库存刀具状态为"待出库" |
| | | if (!list.isEmpty()) { |
| | | // 收集所有需要更新状态的库存ID |
| | | List<String> inventoryIds = list.stream() |
| | |
| | | .collect(Collectors.toList()); |
| | | |
| | | if (!inventoryIds.isEmpty()) { |
| | | // 更新库存状态为"已出库" |
| | | // 更新库存状态为"待出库" |
| | | cuttingInventoryService.updateStatus(inventoryIds, "待出库"); |
| | | } |
| | | } |
| | |
| | | //@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("删除成功!"); |
| | | } |
| | | |
| | |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public Result<String> deleteBatch(@RequestParam(name = "ids") String ids) { |
| | | this.cuttingReceiveService.removeByIds(Arrays.asList(ids.split(","))); |
| | | //FIXME: 批量删除时,库存状态未恢复。也需要批量恢复库存状态。 |
| | | return Result.OK("批量删除成功!"); |
| | | } |
| | | |
| | |
| | | return cuttingReceiveService.submit(orderId); |
| | | } |
| | | |
| | | //TODO: @GetMapping("/handleBack") |
| | | @GetMapping("/handleBack") |
| | | public Result<?> handleBack(@RequestParam("orderId") String orderId) { |
| | | return cuttingReceiveService.handleBack(orderId); |
| | | } |
| | | } |