| | |
| | | List<QlyIsptItem> isptItem = params.getIsptItem(); |
| | | List<Long> list = isptItem.stream().map(QlyIsptItem::getId).collect(Collectors.toList()); |
| | | if (params.getType().equals("2") || params.getType().equals("1")) { |
| | | if (!this.update(new LambdaUpdateWrapper<QlyIsptItem>() |
| | | .set(QlyIsptItem::getIsptResult, params.getType()) |
| | | .in(QlyIsptItem::getId, list))) { |
| | | throw new CoolException("修改失败!!"); |
| | | } |
| | | isptItem.forEach(item -> { |
| | | if (params.getType().equals("1")) { |
| | | //TODO 先捡后收为送货数量,先收后捡为收货数量 |
| | | item.setSafeQty(item.getDlyQty()); |
| | | item.setDisQty(0.0); |
| | | } else { |
| | | item.setSafeQty(0.0); |
| | | item.setDisQty(item.getDlyQty()); |
| | | } |
| | | if (!this.update(new LambdaUpdateWrapper<QlyIsptItem>() |
| | | .set(QlyIsptItem::getSafeQty, item.getSafeQty()) |
| | | .set(QlyIsptItem::getIsptResult, params.getType()) |
| | | .set(QlyIsptItem::getDisQty, item.getDisQty()) |
| | | .in(QlyIsptItem::getId, item.getId()))) { |
| | | throw new CoolException("修改失败!!"); |
| | | } |
| | | }); |
| | | } else { |
| | | if (!this.updateBatchById(isptItem)) { |
| | | throw new CoolException("明细修改失败"); |
| | |
| | | QlyInspect inspect = qlyInspectService.getById(key); |
| | | List<QlyIsptItem> items = listMap.get(key); |
| | | Double safeQty = items.stream().mapToDouble(QlyIsptItem::getSafeQty).sum(); |
| | | Double rcptQty = items.stream().mapToDouble(QlyIsptItem::getSafeQty).sum(); |
| | | Double dlyQty = items.stream().mapToDouble(QlyIsptItem::getDlyQty).sum(); |
| | | Double disQty = items.stream().mapToDouble(QlyIsptItem::getDisQty).sum(); |
| | | Double qlyQty = safeQty + disQty; |
| | | //安全数量,质检数量 |
| | |
| | | if (Double.compare(disQty, 0) > 0) { |
| | | inspect.setIsptResult(Short.parseShort("4")); |
| | | } |
| | | if (Double.compare(safeQty, rcptQty) == 0) { |
| | | if (Double.compare(safeQty, dlyQty) == 0) { |
| | | inspect.setIsptStatus("1"); |
| | | inspect.setIsptResult(Short.parseShort("1")); |
| | | } |
| | | if (!qlyInspectService.updateById(inspect)) { |