| Line 30... |
Line 30... |
| 30 |
import org.springframework.mail.javamail.JavaMailSender;
|
30 |
import org.springframework.mail.javamail.JavaMailSender;
|
| 31 |
import org.springframework.stereotype.Component;
|
31 |
import org.springframework.stereotype.Component;
|
| 32 |
import org.springframework.transaction.annotation.Transactional;
|
32 |
import org.springframework.transaction.annotation.Transactional;
|
| 33 |
|
33 |
|
| 34 |
import com.smartdukaan.cron.scheduled.ScheduledTasks;
|
34 |
import com.smartdukaan.cron.scheduled.ScheduledTasks;
|
| - |
|
35 |
import com.spice.profitmandi.common.enumuration.ItemType;
|
| 35 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
36 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 36 |
import com.spice.profitmandi.common.util.FileUtil;
|
37 |
import com.spice.profitmandi.common.util.FileUtil;
|
| 37 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
38 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
| 38 |
import com.spice.profitmandi.common.util.Utils;
|
39 |
import com.spice.profitmandi.common.util.Utils;
|
| 39 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
40 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| Line 729... |
Line 730... |
| 729 |
//prebookingOrderRepository.select
|
730 |
//prebookingOrderRepository.select
|
| 730 |
// TODO Auto-generated method stub
|
731 |
// TODO Auto-generated method stub
|
| 731 |
|
732 |
|
| 732 |
}
|
733 |
}
|
| 733 |
|
734 |
|
| 734 |
public void fixGrn() {
|
735 |
public void fixGrn() throws Exception {
|
| 735 |
List<Purchase> incompletePurchases = purchaseRepository.selectIncompletePurchase();
|
736 |
List<Purchase> incompletePurchases = purchaseRepository.selectIncompletePurchase();
|
| 736 |
for(Purchase incompletePurchase : incompletePurchases) {
|
737 |
for(Purchase incompletePurchase : incompletePurchases) {
|
| 737 |
List<Order> orders = orderRepository.selectByAirwayBillOrInvoiceNumber(incompletePurchase.getPurchaseReference(), incompletePurchase.getFofoId());
|
738 |
List<Order> orders = orderRepository.selectByAirwayBillOrInvoiceNumber(incompletePurchase.getPurchaseReference(), incompletePurchase.getFofoId());
|
| 738 |
List<InventoryItem> inventoryItems = inventoryItemRepository.selectByPurchaseId(incompletePurchase.getId());
|
739 |
List<InventoryItem> inventoryItems = inventoryItemRepository.selectByPurchaseId(incompletePurchase.getId());
|
| 739 |
Map<Integer, Integer> grnedItems = inventoryItems.stream().collect(
|
740 |
Map<Integer, Integer> grnedItems = inventoryItems.stream().collect(
|
| Line 743... |
Line 744... |
| 743 |
Collectors.groupingBy(x->x.getLineItem().getItemId(),
|
744 |
Collectors.groupingBy(x->x.getLineItem().getItemId(),
|
| 744 |
Collectors.summingInt(x->x.getLineItem().getQuantity())));
|
745 |
Collectors.summingInt(x->x.getLineItem().getQuantity())));
|
| 745 |
for(Integer billedItemId : billedItems.keySet()) {
|
746 |
for(Integer billedItemId : billedItems.keySet()) {
|
| 746 |
if(grnedItems.containsKey(billedItemId)) {
|
747 |
if(grnedItems.containsKey(billedItemId)) {
|
| 747 |
if(grnedItems.get(billedItemId) > billedItems.get(billedItemId)) {
|
748 |
if(grnedItems.get(billedItemId) > billedItems.get(billedItemId)) {
|
| 748 |
LOGGER.info("Billed {}, Grned {}, ItemId {}, Invoice Number {}, Grn Date {}",
|
749 |
LOGGER.info("Billed {}, Grned {}, ItemId {}, Invoice Number {}({}), Grn Date {}",
|
| 749 |
billedItems.get(billedItemId), grnedItems.get(billedItemId), billedItemId, incompletePurchase.getPurchaseReference(), incompletePurchase.getCreateTimestamp());
|
750 |
billedItems.get(billedItemId), grnedItems.get(billedItemId), billedItemId, incompletePurchase.getPurchaseReference(), incompletePurchase.getId(), incompletePurchase.getCreateTimestamp());
|
| - |
|
751 |
Item item = itemRepository.selectById(billedItemId);
|
| - |
|
752 |
if(item.getType().equals(ItemType.SERIALIZED)) {
|
| - |
|
753 |
|
| - |
|
754 |
}
|
| 750 |
}
|
755 |
}
|
| 751 |
}
|
756 |
}
|
| 752 |
}
|
757 |
}
|
| 753 |
|
758 |
|
| 754 |
}
|
759 |
}
|