| | |
| | | import com.zy.common.model.TaskDto; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo())); |
| | | locDto.setFrozen(locDetl.getFrozen()); |
| | | locDto.setFrozenLoc(locMast.getFrozen()); |
| | | List<Integer> staNos; |
| | | if (!Objects.isNull(orderDetl.getStandby1())) { |
| | | BasDevice basDevice = basDeviceService.selectOne(new EntityWrapper<BasDevice>().eq("dev_no", orderDetl.getStandby1())); |
| | | if (Objects.isNull(basDevice)) { |
| | | throw new CoolException("机台信息不存在!!"); |
| | | } |
| | | List<LocAroundBind> binds = locAroundBindService.selectList(new EntityWrapper<LocAroundBind>().eq("dev_no", basDevice.getDevNo())); |
| | | if (Objects.isNull(binds) || binds.isEmpty()) { |
| | | throw new CoolException("台机未绑定工作站台!!"); |
| | | } |
| | | Set<String> locs = binds.stream().map(LocAroundBind::getBLocNo).collect(Collectors.toSet()); |
| | | |
| | | LocMast locMasts = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .in("loc_no", locs) |
| | | .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type) |
| | | .eq("dev_no", basDevice.getDevNo()) |
| | | .orderAsc(Arrays.asList("loc_no")) |
| | | .last("OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY")); |
| | | |
| | | staNos = staDescService.queryOutStaNosByLocNo(locMasts.getLocNo(), issued >= locDetl.getAnfme() ? 101 : 103); |
| | | } else { |
| | | staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), issued >= locDetl.getAnfme() ? 101 : 103); |
| | | } |
| | | |
| | | List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), issued >= locDetl.getAnfme() ? 101 : 103); |
| | | locDto.setStaNos(staNos); |
| | | locDto.setBrand(orderDetl.getBrand()); |
| | | locDto.setStandby1(orderDetl.getStandby1()); |
| | |
| | | |
| | | @PostMapping("/out/pakout/auth") |
| | | @ManagerAuth(memo = "订单出库") |
| | | @Transactional |
| | | public synchronized R pakout(@RequestBody List<LocDto> locDtos) throws InterruptedException { |
| | | if (Cools.isEmpty(locDtos)) { |
| | | return R.parse(BaseRes.PARAM); |
| | |
| | | for (TaskDto taskDto : taskDtos) { |
| | | BasDevp staNo = basDevpService.checkSiteStatus(taskDto.getStaNo()); |
| | | if (!Objects.isNull(taskDto.getDeviceNo())) { |
| | | //生成出库任务 |
| | | workService.stockOut(staNo, taskDto, taskDto.getDeviceNo(), getUserId()); |
| | | //生成匹配的入库(出库)任务 |
| | | workService.genInStock(staNo, taskDto, taskDto.getDeviceNo(), getUserId()); |
| | | } else { |
| | | workService.stockOut(staNo, taskDto, null, getUserId()); |
| | | } |
| | | } |
| | | return R.ok(); |