fixed null pointer Exception
parent
fae2e12c84
commit
c39d5c0805
|
@ -346,12 +346,13 @@ public class InventoryService {
|
||||||
.collect(Collectors.toMap(InventoryTransactionLeg::getParentDocumentId, Function.identity()));
|
.collect(Collectors.toMap(InventoryTransactionLeg::getParentDocumentId, Function.identity()));
|
||||||
for (Bundle subBundle : wrapper.getBundles()) {
|
for (Bundle subBundle : wrapper.getBundles()) {
|
||||||
long accountId = masterBundleDAO.find(subBundle.getMasterBundleId()).getAccountId();
|
long accountId = masterBundleDAO.find(subBundle.getMasterBundleId()).getAccountId();
|
||||||
if(subBundle.getCurrentProduction().compareTo(BigDecimal.ZERO) != 0){
|
if(subBundle.getCurrentProduction() != null && subBundle.getCurrentProduction().compareTo(BigDecimal.ZERO) != 0){
|
||||||
Bundle bundle = bundleDAO.find(subBundle.getId());
|
Bundle bundle = bundleDAO.find(subBundle.getId());
|
||||||
jobCard = jobCardDAO.find(subBundle.getJobCardId());
|
jobCard = jobCardDAO.find(subBundle.getJobCardId());
|
||||||
long production = (bundle.getProduction() == null) ? 0 : bundle.getProduction().longValue() ;
|
long production = (bundle.getProduction() == null) ? 0 : bundle.getProduction().longValue() ;
|
||||||
long wrapQuantity = bundle.getWrapQuantity().longValue();
|
long wrapQuantity = bundle.getWrapQuantity().longValue();
|
||||||
JobCardItem jobCardItem = jobCardItemDAO.findByCardIdAndItemId(subBundle.getJobCardId(),subBundle.getItemId());
|
JobCardItem jobCardItem = jobCardItemDAO.findByCardIdAndItemId(subBundle.getJobCardId(),subBundle.getItemId());
|
||||||
|
BigDecimal previousTotalProduction = jobCardItem.getTotalProduction() == null ? BigDecimal.ZERO : jobCardItem.getTotalProduction();
|
||||||
|
|
||||||
InventoryTransactionLeg lastInvTransaction = lastBundleIdInTransactionMap.getOrDefault(subBundle.getId(), null);
|
InventoryTransactionLeg lastInvTransaction = lastBundleIdInTransactionMap.getOrDefault(subBundle.getId(), null);
|
||||||
|
|
||||||
|
@ -367,10 +368,10 @@ public class InventoryService {
|
||||||
// create IN Transactions of Finished Items into account
|
// create IN Transactions of Finished Items into account
|
||||||
createTransactions(stitchingOfflineItems, accountId, InventoryArtifactType.STITCHING_OFFLINE.name());
|
createTransactions(stitchingOfflineItems, accountId, InventoryArtifactType.STITCHING_OFFLINE.name());
|
||||||
|
|
||||||
jobCardItem.setTotalProduction(jobCardItem.getTotalProduction().add(subBundle.getCurrentProduction()));
|
jobCardItem.setTotalProduction(previousTotalProduction.add(subBundle.getCurrentProduction()));
|
||||||
jobCardItem.setJobCardId(jobCard.getId());
|
jobCardItem.setJobCardId(jobCard.getId());
|
||||||
updatedItems.add(jobCardItem);
|
updatedItems.add(jobCardItem);
|
||||||
BigDecimal pro = subBundle.getCurrentProduction();
|
BigDecimal pro = BigDecimal.valueOf(production + subBundle.getCurrentProduction().longValue());
|
||||||
bundle.setProduction(pro);
|
bundle.setProduction(pro);
|
||||||
bundleDAO.save(bundle);
|
bundleDAO.save(bundle);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue