| Line 65... |
Line 65... |
| 65 |
import com.spice.profitmandi.dao.entity.fofo.PurchaseReturnItem;
|
65 |
import com.spice.profitmandi.dao.entity.fofo.PurchaseReturnItem;
|
| 66 |
import com.spice.profitmandi.dao.entity.fofo.ScanRecord;
|
66 |
import com.spice.profitmandi.dao.entity.fofo.ScanRecord;
|
| 67 |
import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;
|
67 |
import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;
|
| 68 |
import com.spice.profitmandi.dao.entity.fofo.SchemeItem;
|
68 |
import com.spice.profitmandi.dao.entity.fofo.SchemeItem;
|
| 69 |
import com.spice.profitmandi.dao.entity.inventory.SaholicInventorySnapshot;
|
69 |
import com.spice.profitmandi.dao.entity.inventory.SaholicInventorySnapshot;
|
| 70 |
import com.spice.profitmandi.dao.entity.inventory.VendorItemPricing;
|
70 |
import com.spice.profitmandi.dao.entity.inventory.Warehouse;
|
| 71 |
import com.spice.profitmandi.dao.entity.transaction.HdfcPayment;
|
71 |
import com.spice.profitmandi.dao.entity.transaction.HdfcPayment;
|
| 72 |
import com.spice.profitmandi.dao.entity.transaction.LineItem;
|
72 |
import com.spice.profitmandi.dao.entity.transaction.LineItem;
|
| 73 |
import com.spice.profitmandi.dao.entity.transaction.LineItemImei;
|
73 |
import com.spice.profitmandi.dao.entity.transaction.LineItemImei;
|
| 74 |
import com.spice.profitmandi.dao.entity.transaction.ManualPaymentType;
|
74 |
import com.spice.profitmandi.dao.entity.transaction.ManualPaymentType;
|
| 75 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
75 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
| Line 154... |
Line 154... |
| 154 |
@Autowired
|
154 |
@Autowired
|
| 155 |
private LineItemRepository lineItemRepository;
|
155 |
private LineItemRepository lineItemRepository;
|
| 156 |
|
156 |
|
| 157 |
@Autowired
|
157 |
@Autowired
|
| 158 |
private LeadRepository leadRepository;
|
158 |
private LeadRepository leadRepository;
|
| 159 |
|
159 |
|
| 160 |
@Autowired
|
160 |
@Autowired
|
| 161 |
private VendorItemPricingRepository vendorItemPricingRepository;
|
161 |
private VendorItemPricingRepository vendorItemPricingRepository;
|
| 162 |
|
162 |
|
| 163 |
@Autowired
|
163 |
@Autowired
|
| 164 |
private WarehouseRepository warehouseRepository;
|
164 |
private WarehouseRepository warehouseRepository;
|
| 165 |
|
165 |
|
| 166 |
@Autowired
|
166 |
@Autowired
|
| 167 |
private PurchaseReturnItemRepository purchaseReturnItemRepository;
|
167 |
private PurchaseReturnItemRepository purchaseReturnItemRepository;
|
| Line 299... |
Line 299... |
| 299 |
@Autowired
|
299 |
@Autowired
|
| 300 |
private CurrentInventorySnapshotRepository currentInventorySnapshotRepository;
|
300 |
private CurrentInventorySnapshotRepository currentInventorySnapshotRepository;
|
| 301 |
|
301 |
|
| 302 |
@Autowired
|
302 |
@Autowired
|
| 303 |
private OrderRepository orderRepository;
|
303 |
private OrderRepository orderRepository;
|
| 304 |
|
304 |
|
| 305 |
@Autowired
|
305 |
@Autowired
|
| 306 |
private ScanRecordRepository scanRecordRepository;
|
306 |
private ScanRecordRepository scanRecordRepository;
|
| 307 |
|
307 |
|
| 308 |
@Autowired
|
308 |
@Autowired
|
| 309 |
private JavaMailSender mailSender;
|
309 |
private JavaMailSender mailSender;
|
| Line 1383... |
Line 1383... |
| 1383 |
|
1383 |
|
| 1384 |
}
|
1384 |
}
|
| 1385 |
}
|
1385 |
}
|
| 1386 |
|
1386 |
|
| 1387 |
public void fixOrders() throws Exception {
|
1387 |
public void fixOrders() throws Exception {
|
| 1388 |
List<Order> orders = orderRepository.selectAllOrderDatesBetweenByStatus(LocalDate.now().atStartOfDay(), LocalDateTime.now(), OrderStatus.SUBMITTED_FOR_PROCESSING);
|
1388 |
List<Order> orders = orderRepository.selectAllOrderDatesBetweenByStatus(LocalDate.now().atStartOfDay(),
|
| 1389 |
orders = orders.stream().filter(x->x.getCreateTimestamp().isAfter(LocalDateTime.of(2021, 7, 21, 0, 0, 0))).collect(Collectors.toList());
|
- |
|
| 1390 |
for(Order order : orders) {
|
- |
|
| 1391 |
|
- |
|
| 1392 |
LineItem lineItem =
|
- |
|
| 1393 |
lineItemRepository.selectById(order.getLineItem().getId());
|
1389 |
LocalDateTime.now(), OrderStatus.SUBMITTED_FOR_PROCESSING);
|
| 1394 |
if(order.getOrderType()==null) { order.setProductCondition(0);
|
- |
|
| 1395 |
order.setOrderType(0); int itemId = order.getLineItem().getItemId(); int
|
1390 |
orders = orders.stream().filter(x -> x.getCreateTimestamp().isAfter(LocalDateTime.of(2021, 7, 21, 0, 0, 0)))
|
| 1396 |
fulfillmentWarehouseId = order.getFulfilmentWarehouseId();
|
- |
|
| 1397 |
System.out.println("Item id " + itemId); Item item =
|
- |
|
| 1398 |
itemRepository.selectById(itemId);
|
1391 |
.collect(Collectors.toList());
|
| 1399 |
|
- |
|
| 1400 |
VendorItemPricing vendorItemPricing =
|
1392 |
for (Order order : orders) {
|
| 1401 |
vendorItemPricingRepository.selectByItemIdAndVendorId(itemId,
|
- |
|
| 1402 |
fulfillmentWarehouseId); if(vendorItemPricing==null) { vendorItemPricing =
|
- |
|
| 1403 |
vendorItemPricingRepository.selectAll(itemId).get(0); }
|
- |
|
| 1404 |
System.out.println("vendorItemPricing " + vendorItemPricing);
|
- |
|
| 1405 |
lineItem.setProductGoup(item.getProductGroup());
|
- |
|
| 1406 |
lineItem.setColor(item.getColor());
|
- |
|
| 1407 |
lineItem.setNlc(vendorItemPricing.getNlc());
|
- |
|
| 1408 |
lineItem.setTransferPrice(vendorItemPricing.getTp());
|
- |
|
| 1409 |
lineItem.setLogisticsCost(0f); lineItem.setCodCollectionCharges(0f);
|
- |
|
| 1410 |
|
- |
|
| 1411 |
}
|
- |
|
| 1412 |
|
- |
|
| 1413 |
/*
|
1393 |
/*
|
| 1414 |
* int warehouseTo =
|
1394 |
* LineItem lineItem =
|
| 1415 |
* fofoStoreRepository.selectByRetailerId(order.getRetailerId()).getWarehouseId(
|
1395 |
* lineItemRepository.selectById(order.getLineItem().getId()); if
|
| - |
|
1396 |
* (order.getOrderType() == null) { order.setProductCondition(0);
|
| 1416 |
* ); int itemId = order.getLineItem().getItemId(); Warehouse warehouse =
|
1397 |
* order.setOrderType(0); int itemId = order.getLineItem().getItemId(); int
|
| 1417 |
* transactionService.getFulfilmentWarehouseMap(Arrays.asList(itemId),
|
1398 |
* fulfillmentWarehouseId = order.getFulfilmentWarehouseId();
|
| - |
|
1399 |
* System.out.println("Item id " + itemId); Item item =
|
| 1418 |
* warehouseTo).get(itemId);
|
1400 |
* itemRepository.selectById(itemId);
|
| - |
|
1401 |
*
|
| - |
|
1402 |
* VendorItemPricing vendorItemPricing =
|
| - |
|
1403 |
* vendorItemPricingRepository.selectByItemIdAndVendorId(itemId,
|
| - |
|
1404 |
* fulfillmentWarehouseId); if (vendorItemPricing == null) { vendorItemPricing =
|
| - |
|
1405 |
* vendorItemPricingRepository.selectAll(itemId).get(0); }
|
| - |
|
1406 |
* System.out.println("vendorItemPricing " + vendorItemPricing);
|
| 1419 |
* order.setWarehouseId(warehouse.getBillingWarehouseId());
|
1407 |
* lineItem.setProductGoup(item.getProductGroup());
|
| - |
|
1408 |
* lineItem.setColor(item.getColor());
|
| 1420 |
* order.setFulfilmentWarehouseId(warehouse.getId());
|
1409 |
* lineItem.setNlc(vendorItemPricing.getNlc());
|
| - |
|
1410 |
* lineItem.setTransferPrice(vendorItemPricing.getTp());
|
| - |
|
1411 |
* lineItem.setLogisticsCost(0f); lineItem.setCodCollectionCharges(0f);
|
| - |
|
1412 |
*
|
| - |
|
1413 |
* }
|
| 1421 |
*/
|
1414 |
*/
|
| - |
|
1415 |
|
| - |
|
1416 |
int warehouseTo = fofoStoreRepository.selectByRetailerId(order.getRetailerId()).getWarehouseId();
|
| - |
|
1417 |
int itemId = order.getLineItem().getItemId();
|
| - |
|
1418 |
Warehouse warehouse = transactionService.getFulfilmentWarehouseMap(Arrays.asList(itemId), warehouseTo).get(itemId);
|
| - |
|
1419 |
LOGGER.info("Order Id - {}, WarehouseTo - {}, Item Id - {}, Warehouse From - {}, Fulfilment Warehouse Id - {}",
|
| - |
|
1420 |
order.getId(), warehouseTo, itemId, warehouse.getId(), warehouse.getBillingWarehouseId());
|
| - |
|
1421 |
//order.setWarehouseId(warehouse.getBillingWarehouseId());
|
| - |
|
1422 |
//order.setFulfilmentWarehouseId(warehouse.getId());
|
| - |
|
1423 |
|
| 1422 |
}
|
1424 |
}
|
| 1423 |
|
1425 |
|
| 1424 |
}
|
1426 |
}
|
| 1425 |
|
1427 |
|
| 1426 |
}
|
1428 |
}
|
| 1427 |
|
1429 |
|
| 1428 |
//7015845171
|
1430 |
//7015845171
|
| 1429 |
|
1431 |
|