|  |  |  | 
|---|
|  |  |  | PurchaseItem purchaseItem = purchaseItemService.getById(item.getPoDetlId()); | 
|---|
|  |  |  | if (!Objects.isNull(purchaseItem)) { | 
|---|
|  |  |  | purchaseItem.setQty(purchaseItem.getQty() - item.getAnfme()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!purchaseItemService.updateById(purchaseItem)) { | 
|---|
|  |  |  | throw new CoolException("PO单明细更新失败!!"); | 
|---|
|  |  |  | 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)) { | 
|---|
|  |  |  | purchase.setQty(purchase.getQty() - sum) | 
|---|
|  |  |  | .setExceStatus(POExceStatus.PO_EXCE_STATUS_EXCE_ING.val); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!purchaseService.updateById(purchase)) { | 
|---|
|  |  |  | throw new CoolException("PO单据更新失败!!"); | 
|---|
|  |  |  | if (!purchaseService.updateById(purchase)) { | 
|---|
|  |  |  | throw new CoolException("PO单据更新失败!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|