| | |
| | | import org.jeecg.modules.cms.entity.CuttingReceiveDetail; |
| | | import org.jeecg.modules.cms.entity.CuttingScrap; |
| | | import org.jeecg.modules.cms.entity.CuttingScrapDetail; |
| | | import org.jeecg.modules.cms.service.ICuttingInventoryService; |
| | | import org.jeecg.modules.cms.service.ICuttingScrapDetailService; |
| | | import org.jeecg.modules.cms.service.ICuttingScrapService; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private ICuttingScrapDetailService cuttingScrapDetailService; |
| | | |
| | | @Autowired |
| | | private ICuttingInventoryService cuttingInventoryService; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | |
| | | for (CuttingScrapDetail temp : list) { |
| | | temp.setOrderId(cuttingScrap.getId()); |
| | | cuttingScrapDetailService.save(temp); |
| | | } |
| | | |
| | | // 更新库存刀具状态为"已出库" |
| | | if (!list.isEmpty()) { |
| | | // 收集所有需要更新状态的库存ID |
| | | List<String> inventoryIds = list.stream() |
| | | .map(CuttingScrapDetail::getInventoryId) // 假设CuttingScrapDetail中有inventoryId字段 |
| | | .filter(id -> id != null && !id.isEmpty()) |
| | | .collect(Collectors.toList()); |
| | | |
| | | if (!inventoryIds.isEmpty()) { |
| | | // 更新库存状态为"已出库" |
| | | cuttingInventoryService.updateStatus(inventoryIds, "待报废"); |
| | | } |
| | | } |
| | | return Result.OK("添加成功!"); |
| | | } |
| | |
| | | return Result.ok(list); |
| | | } |
| | | |
| | | /** |
| | | * 选择报废刀具的列表 |
| | | */ |
| | | @GetMapping("/getInventoryToolList") |
| | | public Result<?> getInventoryToolList(@RequestParam("pageNo") Integer pageNo, |
| | | @RequestParam("pageSize") Integer pageSize, |
| | | @RequestParam Map<String, Object> params) { |
| | | IPage<Map<String, Object>> inventoryTooList = cuttingScrapService.getInventoryToolList(pageNo, pageSize, params); |
| | | return Result.ok(inventoryTooList); |
| | | } |
| | | |
| | | } |