| | |
| | | */ |
| | | @Override |
| | | public R outOrder(OutTaskParam param,int count) { |
| | | return outOrder(param, count, 1); |
| | | } |
| | | |
| | | private R outOrder(OutTaskParam param, int count, int teu) { |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_sts", "F").eq("barcode", param.getPalletId())); |
| | | if (locMast == null) { |
| | | throw new CoolException("没有找到托盘码=" + param.getPalletId() + "对应的库位"); |
| | |
| | | wrkMast.setEmptyMk("N"); // 空板 |
| | | wrkMast.setLinkMis("N"); |
| | | wrkMast.setPdcType("N"); |
| | | wrkMast.setContainerNo(param.getContainerNo()); |
| | | // 7.11:orderId 存 userNo,batchSeq 存批次标识,seq 存批次内顺序。 |
| | | wrkMast.setUserNo(param.getOrderId());//订单号 |
| | | wrkMast.setBatchSeq(param.getBatchSeq());//订单内批次标识 |
| | |
| | | wrkDetl.setAppeUser(9995L); |
| | | wrkDetl.setModiTime(now); |
| | | wrkDetl.setModiUser(9995L); |
| | | wrkDetl.setTeu(teu); |
| | | // 7.11:entryWmsCode、outDoorNo 复用明细备用字段。 |
| | | wrkDetl.setStandby1(param.getEntryWmsCode()); |
| | | wrkDetl.setStandby2(param.getOutDoorNo()); |
| | |
| | | public R outOrderBatch(List<OutTaskParam> params) { |
| | | int n = params.size(); |
| | | Map<String, Integer> batchLineCounts = new HashMap<>(); |
| | | Map<String, Integer> batchTeuCounts = buildOutOrderBatchTeuCounts(params); |
| | | for (OutTaskParam outTaskParam : params) { |
| | | batchLineCounts.merge(buildOutOrderBatchKey(outTaskParam), 1, Integer::sum); |
| | | } |
| | | for (OutTaskParam outTaskParam : params) { |
| | | int count = batchLineCounts.getOrDefault(buildOutOrderBatchKey(outTaskParam), n); |
| | | R r = outOrder(outTaskParam, count); |
| | | int teu = batchTeuCounts.getOrDefault(outTaskParam.getBatchSeq(), 1); |
| | | R r = outOrder(outTaskParam, count, teu); |
| | | if (!Objects.equals(r.get("code"), 200)) { |
| | | throw new CoolException("出库建单失败"); |
| | | } |
| | |
| | | return param.getOrderId() + "#" + param.getBatchSeq(); |
| | | } |
| | | |
| | | private Map<String, Integer> buildOutOrderBatchTeuCounts(List<OutTaskParam> params) { |
| | | Map<String, Set<String>> batchOrderIds = new HashMap<>(); |
| | | for (OutTaskParam param : params) { |
| | | batchOrderIds.computeIfAbsent(param.getBatchSeq(), k -> new LinkedHashSet<>()).add(param.getOrderId()); |
| | | } |
| | | Map<String, Integer> batchTeuCounts = new HashMap<>(); |
| | | for (Map.Entry<String, Set<String>> entry : batchOrderIds.entrySet()) { |
| | | batchTeuCounts.put(entry.getKey(), entry.getValue().size()); |
| | | } |
| | | return batchTeuCounts; |
| | | } |
| | | |
| | | private String resolveOutboundOrderId(String palletId) { |
| | | List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>() |
| | | .eq("io_type", 101) |