| | |
| | | if (!pakoutService.insert(pakout)) { |
| | | throw new CoolException("保存出库通知单失败"); |
| | | } |
| | | // 修改库存明细数量 |
| | | if (!locDetlService.reduceStock(locDetl.getNodeId(), mat.getMatnr(), issued>=locDetl.getAnfme()?locDetl.getAnfme():issued)) { |
| | | throw new CoolException("修改库存明细数量失败"); |
| | | if (issued>=locDetl.getAnfme()) { |
| | | // 删除库存明细 |
| | | if (!locDetlService.removeStock(locDetl.getNodeId(), mat.getMatnr())) { |
| | | throw new CoolException("删除库存明细失败"); |
| | | } |
| | | } else { |
| | | // 修改库存明细数量 |
| | | if (!locDetlService.reduceStock(locDetl.getNodeId(), mat.getMatnr(), issued)) { |
| | | throw new CoolException("修改库存明细数量失败"); |
| | | } |
| | | } |
| | | // 剩余待出数量递减 |
| | | issued = issued - locDetl.getAnfme(); |