| | |
| | | } |
| | | |
| | | PurchaseItem service = purchaseItemService.getById(item.getId()); |
| | | Double qty = service.getQty() + item.getAnfme(); |
| | | Double qty = Math.round((service.getQty() + item.getAnfme()) * 10000) / 10000.0; |
| | | if (qty.compareTo(service.getAnfme()) > 0) { |
| | | throw new CoolException("新建单据数量不能大于计划数量!!"); |
| | | } |
| | |
| | | if (Objects.isNull(purchaseItem)) { |
| | | throw new CoolException("单据不存在!!"); |
| | | } |
| | | purchaseItem.setQty(purchaseItem.getQty() + item.getAnfme()); |
| | | |
| | | Double toQty = Math.round((purchaseItem.getQty() + item.getAnfme()) * 10000) / 10000.0; |
| | | purchaseItem.setQty(toQty); |
| | | if (!purchaseItemService.updateById(purchaseItem)) { |
| | | throw new CoolException("PO单明细修改失败!!"); |
| | | } |
| | |
| | | throw new CoolException(("Asn单据明细保存失败!!")); |
| | | } |
| | | //任务执行完成,修改已完成数量和PO单执行状态 |
| | | purchase.setQty(sum + purchase.getQty()) |
| | | Double qty = Math.round((sum + purchase.getQty()) * 10000) / 10000.0; |
| | | purchase.setQty(qty) |
| | | .setExceStatus(POExceStatus.PO_EXCE_STATUS_EXCE_ING.val); |
| | | |
| | | if (!purchaseService.saveOrUpdate(purchase)) { |
| | |
| | | list.forEach(item -> { |
| | | PurchaseItem purchaseItem = purchaseItemService.getById(item.getPoDetlId()); |
| | | if (!Objects.isNull(purchaseItem)) { |
| | | purchaseItem.setQty(purchaseItem.getQty() - item.getAnfme()); |
| | | } |
| | | if (!purchaseItemService.updateById(purchaseItem)) { |
| | | throw new CoolException("PO单明细更新失败!!"); |
| | | Double minusQty = Math.round((purchaseItem.getQty() - item.getAnfme()) * 10000) / 10000.0; |
| | | purchaseItem.setQty(minusQty); |
| | | if (!purchaseItemService.updateById(purchaseItem)) { |
| | | throw new CoolException("PO单明细更新失败!!"); |
| | | } |
| | | } |
| | | }); |
| | | |
| | |
| | | |
| | | Purchase purchase = purchaseService.getOne(new LambdaQueryWrapper<Purchase>() |
| | | .eq(Purchase::getCode, list.stream().findFirst().get().getPoCode())); |
| | | purchase.setQty(purchase.getQty() - sum) |
| | | .setExceStatus(POExceStatus.PO_EXCE_STATUS_EXCE_ING.val); |
| | | if (!Objects.isNull(purchase)) { |
| | | Double qty = Math.round((purchase.getQty() - sum) * 10000) / 10000.0; |
| | | purchase.setQty(qty) |
| | | .setExceStatus(POExceStatus.PO_EXCE_STATUS_EXCE_ING.val); |
| | | |
| | | if (!purchaseService.updateById(purchase)) { |
| | | throw new CoolException("PO单据更新失败!!"); |
| | | if (!purchaseService.updateById(purchase)) { |
| | | throw new CoolException("PO单据更新失败!!"); |
| | | } |
| | | } |
| | | } |
| | | |