| Line 243... |
Line 243... |
| 243 |
List<ScanRecord> scanRecords = scanRecordRepository.selectByInventoryItemId(ii.getId());
|
243 |
List<ScanRecord> scanRecords = scanRecordRepository.selectByInventoryItemId(ii.getId());
|
| 244 |
for (ScanRecord scanRecord : scanRecords) {
|
244 |
for (ScanRecord scanRecord : scanRecords) {
|
| 245 |
if (scanRecord.getType().equals(ScanType.PURCHASE)) {
|
245 |
if (scanRecord.getType().equals(ScanType.PURCHASE)) {
|
| 246 |
CurrentInventorySnapshot cis = currentInventorySnapshotRepository
|
246 |
CurrentInventorySnapshot cis = currentInventorySnapshotRepository
|
| 247 |
.selectByItemIdAndFofoId(itemQtyEntry.getKey(), purchase.getFofoId());
|
247 |
.selectByItemIdAndFofoId(itemQtyEntry.getKey(), purchase.getFofoId());
|
| 248 |
if (cis.getAvailability() - quantityToReduce > 0) {
|
248 |
if (cis.getAvailability() - quantityToReduce >= 0) {
|
| 249 |
scanRecord.setQuantity(scanRecord.getQuantity() - quantityToReduce);
|
249 |
scanRecord.setQuantity(scanRecord.getQuantity() - quantityToReduce);
|
| 250 |
ii.setInitialQuantity(ii.getInitialQuantity() - quantityToReduce);
|
250 |
ii.setInitialQuantity(ii.getInitialQuantity() - quantityToReduce);
|
| 251 |
ii.setGoodQuantity(ii.getGoodQuantity() - quantityToReduce);
|
251 |
ii.setGoodQuantity(ii.getGoodQuantity() - quantityToReduce);
|
| 252 |
cis.setAvailability(cis.getAvailability() - quantityToReduce);
|
252 |
cis.setAvailability(cis.getAvailability() - quantityToReduce);
|
| 253 |
purchase.setUnfullfilledNonSerializedQuantity(
|
253 |
purchase.setUnfullfilledNonSerializedQuantity(
|