| | |
| | | import com.zy.common.model.ExistDto; |
| | | import com.zy.common.model.LocDto; |
| | | import com.zy.common.model.TaskDto; |
| | | import com.zy.common.utils.OutStockInterceptUtil; |
| | | import com.zy.common.utils.RoleUtils; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | |
| | | return R.ok().add(result); |
| | | } |
| | | |
| | | /** 处理订单出库货位分配 |
| | | /** |
| | | * 处理订单出库货位分配 |
| | | * |
| | | * @param jsonObject 请求参数(包含订单明细ID列表和出库数量) |
| | | */ |
| | | @PostMapping("/out/pakout/OrderOutGetLoc.number/auth") |
| | |
| | | |
| | | /** |
| | | * 处理单个订单明细的货位分配 |
| | | * |
| | | * @param orderDetl 订单明细 |
| | | * @param requiredAmount 需求出库量 |
| | | * @param processedLocs 已处理的货位集合(用于去重) |
| | |
| | | return result; |
| | | } |
| | | |
| | | /** 创建缺量DTO */ |
| | | /** |
| | | * 创建缺量DTO |
| | | */ |
| | | private LocDto createShortageDto(OrderDetl orderDetl, double qty) { |
| | | LocDto dto = new LocDto(null, orderDetl.getMatnr(), |
| | | orderDetl.getMaktx(), orderDetl.getBatch(), |
| | |
| | | return dto; |
| | | } |
| | | |
| | | /** 处理普通货位 */ |
| | | /** |
| | | * 处理普通货位 |
| | | */ |
| | | private void processNormalLocation(LocDetl stock, OrderDetl orderDetl, double remaining, |
| | | Set<ExistDto> processedStock, List<LocDto> result) { |
| | | ExistDto exist = new ExistDto() |
| | |
| | | } |
| | | } |
| | | |
| | | /** 处理7号堆垛机货位 */ |
| | | /** |
| | | * 处理7号堆垛机货位 |
| | | */ |
| | | private void processCrn7Location(LocMast baseLoc, LocDetl stock, OrderDetl orderDetl, |
| | | double remaining, Set<ExistDto> processedStock, |
| | | List<LocDto> result) { |
| | |
| | | .forEach(loc -> processCrn7SubLocation(loc, stock, orderDetl, remaining, processedStock, result)); |
| | | } |
| | | |
| | | /** 处理7号堆垛机子货位 */ |
| | | /** |
| | | * 处理7号堆垛机子货位 |
| | | */ |
| | | private void processCrn7SubLocation(LocMast loc, LocDetl stock, OrderDetl orderDetl, |
| | | double remaining, Set<ExistDto> processedStock, |
| | | List<LocDto> result) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** 构建货位DTO通用方法 */ |
| | | /** |
| | | * 构建货位DTO通用方法 |
| | | */ |
| | | private LocDto buildLocDto(LocDetl stock, OrderDetl orderDetl, double qty) { |
| | | LocDto dto = new LocDto( |
| | | stock.getLocNo(), stock.getMatnr(), stock.getMaktx(), |
| | |
| | | // } |
| | | |
| | | |
| | | /** 四向库订单出库 **/ |
| | | /** |
| | | * 四向库订单出库 |
| | | **/ |
| | | @PostMapping("/out/pakout/previewCustomQuantity/auth/sxk") |
| | | @ManagerAuth |
| | | public R pakoutPreviewCustomQuantitySXK(@RequestBody JSONObject jsonObject) { |
| | |
| | | } |
| | | issued = amount; |
| | | } |
| | | if (issued <= 0.0D) { continue; } |
| | | if (issued <= 0.0D) { |
| | | continue; |
| | | } |
| | | List<LocDetl> locDetls = new ArrayList<>(); |
| | | locDetls = locDetlService.queryStockFour(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist,orderDetl.getSupp(),orderDetl.getTemp1(),orderDetl.getTemp2()); |
| | | for (LocDetl locDetl : locDetls) { |
| | |
| | | |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getWorkQty()).orElse(0.0D); |
| | | if (issued <= 0.0D) { continue; } |
| | | if (issued <= 0.0D) { |
| | | continue; |
| | | } |
| | | List<LocDetl> locDetls = new ArrayList<>(); |
| | | locDetls = locDetlService.queryStockFour(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist,orderDetl.getSupp(),orderDetl.getTemp1(),orderDetl.getTemp2()); |
| | | for (LocDetl locDetl : locDetls) { |
| | |
| | | return R.ok().add(locDtos); |
| | | } |
| | | |
| | | /** ctu订单出库 **/ |
| | | /** |
| | | * ctu订单出库 |
| | | **/ |
| | | @PostMapping("/out/pakout/previewCustomQuantity/auth/ctu") |
| | | @ManagerAuth |
| | | public R pakoutPreviewCustomQuantityCTU(@RequestBody JSONObject jsonObject) { |
| | |
| | | } |
| | | issued = amount; |
| | | } |
| | | if (issued <= 0.0D) { continue; } |
| | | if (issued <= 0.0D) { |
| | | continue; |
| | | } |
| | | List<LocDetl> locDetls = new ArrayList<>(); |
| | | locDetls = locDetlService.queryStockMinAnfme(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist,orderDetl.getSupp(),orderDetl.getTemp1(),orderDetl.getTemp2()); |
| | | for (LocDetl locDetl : locDetls) { |
| | |
| | | |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getWorkQty()).orElse(0.0D); |
| | | if (issued <= 0.0D) { continue; } |
| | | if (issued <= 0.0D) { |
| | | continue; |
| | | } |
| | | List<LocDetl> locDetls = new ArrayList<>(); |
| | | locDetls = locDetlService.queryStockMinAnfme(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist,orderDetl.getSupp(),orderDetl.getTemp1(),orderDetl.getTemp2()); |
| | | for (LocDetl locDetl : locDetls) { |
| | |
| | | return R.ok().add(locDtos); |
| | | } |
| | | |
| | | /** crn订单出库 **/ |
| | | /** |
| | | * crn订单出库 |
| | | **/ |
| | | @PostMapping("/out/pakout/previewCustomQuantity/auth/crn") |
| | | @ManagerAuth |
| | | public R pakoutPreviewCustomQuantityCRN(@RequestBody JSONObject jsonObject) { |
| | |
| | | } |
| | | issued = amount; |
| | | } |
| | | if (issued <= 0.0D) { continue; } |
| | | if (issued <= 0.0D) { |
| | | continue; |
| | | } |
| | | List<LocDetl> locDetls = new ArrayList<>(); |
| | | locDetls = locDetlService.queryStockCrn(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist,orderDetl.getSupp(),orderDetl.getTemp1(),orderDetl.getTemp2()); |
| | | for (LocDetl locDetl : locDetls) { |
| | |
| | | |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getWorkQty()).orElse(0.0D); |
| | | if (issued <= 0.0D) { continue; } |
| | | if (issued <= 0.0D) { |
| | | continue; |
| | | } |
| | | List<LocDetl> locDetls = new ArrayList<>(); |
| | | locDetls = locDetlService.queryStockCrn(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist,orderDetl.getSupp(),orderDetl.getTemp1(),orderDetl.getTemp2()); |
| | | for (LocDetl locDetl : locDetls) { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @PostMapping("/out/pakout/auth") |
| | | @ManagerAuth(memo = "订单出库") |
| | | public synchronized R pakout(@RequestBody List<LocDto> locDtos) throws InterruptedException { |
| | |
| | | List<TaskDto> taskDtos = new ArrayList<>(); |
| | | // 根据 (库位 & 出库站) 分组; 理想状态:一组为一次出库任务 |
| | | for (LocDto locDto : locDtos) { |
| | | if (locDto.isLack()) { continue; } |
| | | if (locDto.isLack()) { |
| | | continue; |
| | | } |
| | | TaskDto taskDto = new TaskDto(locDto.getLocNo(), locDto.getStaNo(), locDto); |
| | | if (TaskDto.has(taskDtos, taskDto)) { |
| | | TaskDto dto = TaskDto.find(taskDtos, taskDto); |
| | |
| | | List<TaskDto> taskDtos = new ArrayList<>(); |
| | | // 根据 (库位 & 出库站) 分组; 理想状态:一组为一次出库任务 |
| | | for (LocDto locDto : locDtos) { |
| | | if (locDto.isLack()) { continue; } |
| | | if (locDto.isLack()) { |
| | | continue; |
| | | } |
| | | TaskDto taskDto = new TaskDto(locDto.getLocNo(), locDto.getStaNo(), locDto); |
| | | if (TaskDto.has(taskDtos, taskDto)) { |
| | | TaskDto dto = TaskDto.find(taskDtos, taskDto); |