| | |
| | | } |
| | | log.info("[outOrder] cache: {}", JSON.toJSONString(params)); |
| | | request.setAttribute("cache", params); |
| | | Map<String, List<OutTaskParam>> linesByBatch = new LinkedHashMap<>(); |
| | | Map<String, List<OutTaskParam>> linesByBatchSeq = new LinkedHashMap<>(); |
| | | for (OutTaskParam outTaskParam : params) { |
| | | if (Cools.isEmpty(outTaskParam) || Cools.isEmpty(outTaskParam.getOrderId())) { |
| | | return R.error("出库单号不能为空"); |
| | |
| | | if (Cools.isEmpty(outTaskParam.getStationId())) { |
| | | return R.error("托盘「" + outTaskParam.getPalletId() + "」出库口编码不能为空"); |
| | | } |
| | | linesByBatch.computeIfAbsent(outTaskParam.getBatchSeq(), k -> new ArrayList<>()).add(outTaskParam); |
| | | linesByBatchSeq.computeIfAbsent(outTaskParam.getBatchSeq(), k -> new ArrayList<>()).add(outTaskParam); |
| | | } |
| | | |
| | | for (Map.Entry<String, List<OutTaskParam>> entry : linesByBatch.entrySet()) { |
| | | for (Map.Entry<String, List<OutTaskParam>> entry : linesByBatchSeq.entrySet()) { |
| | | List<OutTaskParam> lines = entry.getValue(); |
| | | OutTaskParam head = lines.get(0); |
| | | String oid = head.getOrderId(); |
| | |
| | | } |
| | | } |
| | | |
| | | List<OutTaskParam> groupedParams = new ArrayList<>(params.size()); |
| | | for (List<OutTaskParam> lines : linesByBatchSeq.values()) { |
| | | groupedParams.addAll(lines); |
| | | } |
| | | |
| | | Set<String> seenPallet = new LinkedHashSet<>(); |
| | | for (OutTaskParam outTaskParam : params) { |
| | | for (OutTaskParam outTaskParam : groupedParams) { |
| | | String pid = outTaskParam.getPalletId(); |
| | | String palletKey = pid == null ? "" : pid; |
| | | if (!seenPallet.add(palletKey)) { |
| | |
| | | |
| | | List<OutTaskParam> missingStock = Lists.newArrayList(); |
| | | List<OutTaskParam> missingLoc = Lists.newArrayList(); |
| | | for (OutTaskParam outTaskParam : params) { |
| | | for (OutTaskParam outTaskParam : groupedParams) { |
| | | int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", outTaskParam.getPalletId())); |
| | | if (countLoc == 0) { |
| | | missingStock.add(outTaskParam); |
| | |
| | | return R.error("没有找到托盘码对应库位:" + String.join(",", badPalletIds)).add(missingLoc); |
| | | } |
| | | |
| | | return openService.outOrderBatch(params); |
| | | return openService.outOrderBatch(linesByBatchSeq); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | private String buildOutOrderBatchKey(OutTaskParam param) { |
| | | return param.getOrderId() + "#" + param.getBatchSeq(); |
| | | } |
| | | |
| | | /** |
| | | * 推荐出库站点 |
| | | */ |
| | | @PostMapping("/pakoutStaNo") |
| | | public synchronized R pakoutStaNo(@RequestBody List<String> barcodes) { |
| | | String StaNo = "1,2,3,4,5"; |
| | | return R.ok().add(StaNo); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | AxisBean cube5 = new AxisBean(); |
| | | cube5.setName("入库体积"); |
| | | AxisBean cube15 = new AxisBean(); |
| | | cube15.setName("出库体积"); |
| | | List<WorkCubeTotalAxis> workCubeTotalAxes = reportQueryMapper.getCubeTotal(); |
| | | List<WorkCubeTotalAxis> workCubeTotalAxes = reportQueryMapper.getInboundCubeTotal(); |
| | | Map<String, WorkCubeTotalAxis> cubeMap = new HashMap<String, WorkCubeTotalAxis>(); |
| | | if (workCubeTotalAxes != null) { |
| | | for (WorkCubeTotalAxis w : workCubeTotalAxes) { |
| | |
| | | } |
| | | } |
| | | ArrayList<Number> data4 = new ArrayList<Number>(); |
| | | ArrayList<Number> data5 = new ArrayList<Number>(); |
| | | SimpleDateFormat sfCube = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar calendarCube = Calendar.getInstance(); |
| | | calendarCube.add(Calendar.DATE, -12); |
| | |
| | | String str = sfCube.format(calendarCube.getTime()); |
| | | WorkCubeTotalAxis cubeAxis = cubeMap.get(str); |
| | | data4.add(cubeAxis == null || cubeAxis.getCube5Total() == null ? 0 : cubeAxis.getCube5Total()); |
| | | data5.add(cubeAxis == null || cubeAxis.getCube15Total() == null ? 0 : cubeAxis.getCube15Total()); |
| | | } |
| | | Number[] array4 = new Number[data4.size()]; |
| | | cube5.setData(data4.toArray(array4)); |
| | | list.add(cube5); |
| | | Number[] array5 = new Number[data5.size()]; |
| | | cube15.setData(data5.toArray(array5)); |
| | | list.add(cube15); |
| | | |
| | | } |
| | | map.put("rows",list); |
| | | return R.ok(map); |
| | |
| | | if (w.getYmd() != null && key.equals(w.getYmd().trim())) { |
| | | inV = w.getInqty(); |
| | | outV = w.getOutqty(); |
| | | inC = w.getCube_inqty(); |
| | | outC = w.getCube_outqty(); |
| | | inC = w.getCubeInqty(); |
| | | outC = w.getCubeOutqty(); |
| | | break; |
| | | } |
| | | } |
| | |
| | | outqty.setData(data2.toArray(array2)); |
| | | list.add(outqty); |
| | | |
| | | AxisBean cubeInqty = new AxisBean(); |
| | | cubeInqty.setName("入库体积"); |
| | | Integer[] array3 = new Integer[data3.size()]; |
| | | cubeInqty.setData(data3.toArray(array3)); |
| | | list.add(cubeInqty); |
| | | if (data3.size() >0) { |
| | | AxisBean cubeInqty = new AxisBean(); |
| | | cubeInqty.setName("入库体积"); |
| | | Integer[] array3 = new Integer[data3.size()]; |
| | | cubeInqty.setData(data3.toArray(array3)); |
| | | list.add(cubeInqty); |
| | | } |
| | | |
| | | AxisBean cubeOutqty = new AxisBean(); |
| | | cubeOutqty.setName("出库体积"); |
| | | Integer[] array4 = new Integer[data4.size()]; |
| | | cubeOutqty.setData(data4.toArray(array4)); |
| | | list.add(cubeOutqty); |
| | | |
| | | if (data3.size() >0) { |
| | | AxisBean cubeOutqty = new AxisBean(); |
| | | cubeOutqty.setName("出库体积"); |
| | | Integer[] array4 = new Integer[data4.size()]; |
| | | cubeOutqty.setData(data4.toArray(array4)); |
| | | list.add(cubeOutqty); |
| | | } |
| | | map.put("categories", categories); |
| | | map.put("rows", list); |
| | | return R.ok(map); |