| | |
| | | import com.core.common.*; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.PakoutRequest; |
| | | import com.zy.asrs.entity.param.StockOutParam; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.model.LocDetlDto; |
| | |
| | | return R.ok().add(orderDetlService.selectByOrderId(orderId).stream().map(OrderDetl::getId).distinct().collect(Collectors.toList())); |
| | | } |
| | | |
| | | @PostMapping("/getMesOrder/auth") |
| | | @ManagerAuth |
| | | public R getMesOrder() { |
| | | List<String> orderNoList = orderService.getOrderNosByDocType(25L); |
| | | return R.ok().add(orderNoList); |
| | | } |
| | | |
| | | @PostMapping("/out/pakout/preview/auth") |
| | | @ManagerAuth |
| | | public R pakoutPreview(@RequestBody List<Long> ids) { |
| | |
| | | |
| | | // 按包装组号分组处理 |
| | | Map<String, List<OrderDetl>> brandGroup = orderDetls.stream() |
| | | .collect(Collectors.groupingBy(OrderDetl::getBrand)); |
| | | .collect(Collectors.groupingBy(o -> { |
| | | String brand = o.getBrand(); |
| | | return brand != null ? brand : "跨巷道"; |
| | | })); |
| | | |
| | | |
| | | List<LocDto> locDtos = new ArrayList<>(); |
| | | |
| | |
| | | // 获取出库口 |
| | | List<Integer> staNos = new ArrayList<>(); |
| | | if (order.getDocType() == 21) { |
| | | staNos.add(3077); staNos.add(3106); |
| | | staNos.add(3077); |
| | | staNos.add(3106); |
| | | } else if (order.getDocType() == 22) { |
| | | staNos.add(2041); |
| | | } else if (order.getDocType() == 23) { |
| | | staNos.add(3092); staNos.add(3102); staNos.add(3095); |
| | | staNos.add(3092); |
| | | staNos.add(3102); |
| | | staNos.add(3095); |
| | | } |
| | | |
| | | // 去重 key,避免相同 loc+unit+model 重复显示 |
| | |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | List<LocDto> locDtos = new ArrayList<>(); |
| | | for (Long id : ids){ |
| | | for (Long id : ids) { |
| | | Order order = orderService.selectById(id); |
| | | List<OrderDetl> orderDetls = orderDetlService.selectByOrderId(order.getId()); |
| | | |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | LocDto locDto = new LocDto(orderDetl.getManu(), orderDetl.getMatnr(), orderDetl.getMaktx(),orderDetl.getModel(),orderDetl.getSpecs(), |
| | | orderDetl.getBatch(),orderDetl.getBrand(),orderDetl.getBarcode(), orderDetl.getOrderNo(),orderDetl.getAnfme()); |
| | | LocDto locDto = new LocDto(orderDetl.getManu(), orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getModel(), orderDetl.getSpecs(), |
| | | orderDetl.getBatch(), orderDetl.getBrand(), orderDetl.getBarcode(), orderDetl.getOrderNo(), orderDetl.getAnfme()); |
| | | locDto.setOrderDetlId(orderDetl.getId()); |
| | | locDto.setTkType(orderDetl.getTkType()); |
| | | locDtos.add(locDto); |
| | |
| | | |
| | | @PostMapping("/out/pakout/auth") |
| | | @ManagerAuth(memo = "订单出库") |
| | | public synchronized R pakout(@RequestBody List<LocDto> locDtos) throws InterruptedException { |
| | | public synchronized R pakout(@RequestBody PakoutRequest request) throws InterruptedException { |
| | | List<LocDto> locDtos = request.getTableCache(); |
| | | String optionValue = request.getOptionValue(); |
| | | if (Cools.isEmpty(locDtos)) { |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | |
| | | .eq("model", paramLocDetl.getModel())); |
| | | |
| | | if (one != null) { |
| | | if (!"合格".equals(one.getThreeCode())) { |
| | | throw new CoolException(one.getModel() + "卷不合格: " + one.getThreeCode()); |
| | | // 判断是否为盘点单(docType == 23),如果不是则校验合格性 |
| | | Order order = orderService.selectByNo(stockOutParam.getOrderNo()); |
| | | if (order.getDocType() != 23) { |
| | | if (order.getDocType() == 26 || order.getDocType() == 27) { |
| | | if ("合格".equals(one.getThreeCode())) { |
| | | throw new CoolException(one.getModel() + "卷是合格: " + one.getThreeCode()); |
| | | } |
| | | } else { |
| | | if (!"合格".equals(one.getThreeCode())) { |
| | | throw new CoolException(one.getModel() + "卷不合格: " + one.getThreeCode()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | locDetlDtos.add(new LocDetlDto(one, paramLocDetl.getCount(), stockOutParam.getOrderNo())); |
| | | } |
| | | |
| | | } |
| | | |
| | | if (!locDetlDtos.isEmpty()) { |
| | |
| | | .eq("loc_no", locDetlDtos.get(0).getLocDetl().getLocNo())); |
| | | if ("F".equals(locMast.getLocSts()) || "D".equals(locMast.getLocSts())) { |
| | | Order order = orderService.selectByNo(stockOutParam.getOrderNo()); |
| | | IoWorkType ioWorkType = (order.getDocType() != null && order.getDocType() == 23) |
| | | ? IoWorkType.CHECK_OUT : null; |
| | | if (order.getDocType() != null) { |
| | | if (order.getDocType() == 26 || order.getDocType() == 27) { |
| | | ioWorkType = IoWorkType.ALL_OUT; |
| | | } |
| | | } |
| | | workService.stockOut(staNo, locDetlDtos, |
| | | order.getDocType() != null && order.getDocType() == 23 |
| | | ? IoWorkType.CHECK_OUT : null, |
| | | getUserId()); |
| | | ioWorkType, |
| | | getUserId(), optionValue); |
| | | } else { |
| | | throw new CoolException("所选库位状态不为F/D,库位号:" + |
| | | locMast.getLocNo() + ",当前状态:" + |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/out/refund/loc/auth") |
| | | @ManagerAuth(memo = "订单出库") |
| | | public synchronized R refundLoc(@RequestBody List<LocDto> locDtos) throws InterruptedException { |
| | |
| | | long nowOrderNo = System.currentTimeMillis(); |
| | | Order order = new Order( |
| | | String.valueOf(snowflakeIdWorker.nextId()), // 编号[非空] |
| | | "TK"+nowOrderNo, // 订单编号 |
| | | "TK" + nowOrderNo, // 订单编号 |
| | | DateUtils.convert(now), // 单据日期 |
| | | docType.getDocId(), // 单据类型 |
| | | null, // 项目编号 |
| | |
| | | throw new CoolException("保存订单主档失败"); |
| | | } |
| | | // 单据明细档 |
| | | int i=0; |
| | | int i = 0; |
| | | List<LocDto> locDtosList = new ArrayList<>(); |
| | | List<String> batchList = new ArrayList<>(); |
| | | for (LocDto locDto : locDtos) { |
| | | if (!batchList.contains(locDto.getBatch())){ |
| | | if (!batchList.contains(locDto.getBatch())) { |
| | | batchList.add(locDto.getBatch()); |
| | | locDtosList.add(locDto); |
| | | } |