| Line 24... |
Line 24... |
| 24 |
import java.io.FileWriter;
|
24 |
import java.io.FileWriter;
|
| 25 |
import java.io.IOException;
|
25 |
import java.io.IOException;
|
| 26 |
import java.io.InputStreamReader;
|
26 |
import java.io.InputStreamReader;
|
| 27 |
import java.util.ArrayList;
|
27 |
import java.util.ArrayList;
|
| 28 |
import java.util.HashMap;
|
28 |
import java.util.HashMap;
|
| - |
|
29 |
import java.util.HashSet;
|
| - |
|
30 |
import java.util.Iterator;
|
| 29 |
import java.util.List;
|
31 |
import java.util.List;
|
| 30 |
import java.util.Map;
|
32 |
import java.util.Map;
|
| - |
|
33 |
import java.util.Set;
|
| 31 |
|
34 |
|
| 32 |
import javax.mail.MessagingException;
|
35 |
import javax.mail.MessagingException;
|
| 33 |
|
36 |
|
| 34 |
import org.apache.commons.lang.StringUtils;
|
37 |
import org.apache.commons.lang.StringUtils;
|
| 35 |
import org.apache.http.Header;
|
38 |
import org.apache.http.Header;
|
| Line 47... |
Line 50... |
| 47 |
import org.apache.thrift.transport.TTransportException;
|
50 |
import org.apache.thrift.transport.TTransportException;
|
| 48 |
|
51 |
|
| 49 |
|
52 |
|
| 50 |
public class NlcLeftOutInventoryDetailScript{
|
53 |
public class NlcLeftOutInventoryDetailScript{
|
| 51 |
|
54 |
|
| 52 |
private static String SNAPDEAL_INVENTORY_SHEET;
|
- |
|
| 53 |
private static long time = System.currentTimeMillis();
|
- |
|
| 54 |
//private static ArrayList<Inventory> currentInventoryItemList;
|
55 |
//private static ArrayList<Inventory> currentInventoryItemList;
|
| 55 |
private static List<SnapdealItemDetails> snapdealItems;
|
56 |
private static List<SnapdealItemDetails> snapdealItems;
|
| 56 |
private static List<FlipkartItem> flipkartItems;
|
57 |
private static List<FlipkartItem> flipkartItems;
|
| 57 |
private static List<FlipkartItem> flipkartInventoryItems = new ArrayList<FlipkartItem>();
|
58 |
private static List<FlipkartItem> flipkartInventoryItems = new ArrayList<FlipkartItem>();
|
| 58 |
static Map<Long,SnapdealItemDetails> snapdealItemMap = new HashMap<Long,SnapdealItemDetails>();
|
59 |
static Map<Long,SnapdealItemDetails> snapdealItemMap = new HashMap<Long,SnapdealItemDetails>();
|
| Line 66... |
Line 67... |
| 66 |
static String sendTo[];
|
67 |
static String sendTo[];
|
| 67 |
private static List<NlcLeftOutInventory> nlcLeftOutInventoryItemsSD = new ArrayList<NlcLeftOutInventory>();
|
68 |
private static List<NlcLeftOutInventory> nlcLeftOutInventoryItemsSD = new ArrayList<NlcLeftOutInventory>();
|
| 68 |
private static List<NlcLeftOutInventory> nlcLeftOutInventoryItemsFK = new ArrayList<NlcLeftOutInventory>();
|
69 |
private static List<NlcLeftOutInventory> nlcLeftOutInventoryItemsFK = new ArrayList<NlcLeftOutInventory>();
|
| 69 |
|
70 |
|
| 70 |
static{
|
71 |
static{
|
| 71 |
//sdf = new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
|
- |
|
| 72 |
emailFromAddress = "build@shop2020.in";
|
72 |
emailFromAddress = "build@shop2020.in";
|
| 73 |
password = "cafe@nes";
|
73 |
password = "cafe@nes";
|
| 74 |
mailer = new GmailUtils();
|
74 |
mailer = new GmailUtils();
|
| 75 |
sendTo = new String[]{"vikram.raghav@shop2020.in", "manish.sharma@shop2020.in"};
|
75 |
sendTo = new String[]{"vikram.raghav@shop2020.in", "manish.sharma@shop2020.in"};
|
| 76 |
/*sendTo = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
|
76 |
/*sendTo = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
|
| Line 154... |
Line 154... |
| 154 |
List<Vendor> allVendors = inventoryClient.getAllVendors();
|
154 |
List<Vendor> allVendors = inventoryClient.getAllVendors();
|
| 155 |
for(Vendor v: allVendors){
|
155 |
for(Vendor v: allVendors){
|
| 156 |
vendorDataMap.put(v.getId(), v.getName());
|
156 |
vendorDataMap.put(v.getId(), v.getName());
|
| 157 |
}
|
157 |
}
|
| 158 |
List<in.shop2020.model.v1.inventory.IgnoredInventoryUpdateItems> ignoreItems = inventoryClient.getIgnoredWarehouseidsAndItemids();
|
158 |
List<in.shop2020.model.v1.inventory.IgnoredInventoryUpdateItems> ignoreItems = inventoryClient.getIgnoredWarehouseidsAndItemids();
|
| 159 |
//SNAPDEAL_INVENTORY_SHEET = "/home/snapdeal/snapdeal-inventory-"+time+".xls";
|
- |
|
| - |
|
159 |
|
| 160 |
availability = inventoryClient.getInventorySnapshot(0);
|
160 |
availability = inventoryClient.getInventorySnapshot(0);
|
| 161 |
List<Warehouse> allwarehouses = inventoryClient.getWarehouses(null,null,0,0,0);
|
161 |
List<Warehouse> allwarehouses = inventoryClient.getWarehouses(null,null,0,0,0);
|
| 162 |
Map<Long,Warehouse> allWarehousesMap = new HashMap<Long,Warehouse>();
|
162 |
Map<Long,Warehouse> allWarehousesMap = new HashMap<Long,Warehouse>();
|
| 163 |
for(Warehouse warehouse:allwarehouses){
|
163 |
for(Warehouse warehouse:allwarehouses){
|
| 164 |
allWarehousesMap.put(warehouse.getId(),warehouse);
|
164 |
allWarehousesMap.put(warehouse.getId(),warehouse);
|
| Line 180... |
Line 180... |
| 180 |
long total_held=0;*/
|
180 |
long total_held=0;*/
|
| 181 |
double nlc=0;
|
181 |
double nlc=0;
|
| 182 |
double maxnlcSD=0;
|
182 |
double maxnlcSD=0;
|
| 183 |
double maxnlcFK=0;
|
183 |
double maxnlcFK=0;
|
| 184 |
|
184 |
|
| 185 |
Map<String, NlcLeftOutInventory> snapdealLeftInvDataMap = new HashMap<String, NlcLeftOutInventory>();
|
185 |
Map<String, Set<NlcLeftOutInventory>> snapdealLeftInvDataMap = new HashMap<String, Set<NlcLeftOutInventory>>();
|
| 186 |
Map<String, NlcLeftOutInventory> flipkartLeftInvDataMap = new HashMap<String, NlcLeftOutInventory>();
|
186 |
Map<String, Set<NlcLeftOutInventory>> flipkartLeftInvDataMap = new HashMap<String, Set<NlcLeftOutInventory>>();
|
| 187 |
|
187 |
|
| 188 |
|
188 |
|
| 189 |
for(Item thriftItem : aliveItems){
|
189 |
for(Item thriftItem : aliveItems){
|
| 190 |
SnapdealItemDetails snapdealItem = null;
|
190 |
SnapdealItemDetails snapdealItem = null;
|
| 191 |
FlipkartItem flipkartItem = null;
|
191 |
FlipkartItem flipkartItem = null;
|
| 192 |
NlcLeftOutInventory nlcLOISD;
|
192 |
NlcLeftOutInventory nlcLOISD;
|
| 193 |
NlcLeftOutInventory nlcLOIFK;
|
193 |
NlcLeftOutInventory nlcLOIFK;
|
| 194 |
maxnlcSD=0;
|
194 |
maxnlcSD=0;
|
| 195 |
maxnlcFK=0;
|
195 |
maxnlcFK=0;
|
| - |
|
196 |
Set<NlcLeftOutInventory> nlcLoiSetSD = new HashSet<NlcLeftOutInventory>();
|
| - |
|
197 |
Set<NlcLeftOutInventory> nlcLoiSetFK = new HashSet<NlcLeftOutInventory>();
|
| 196 |
if(snapdealItemMap.containsKey(thriftItem.getId())){
|
198 |
if(snapdealItemMap.containsKey(thriftItem.getId())){
|
| 197 |
snapdealItem = snapdealItemMap.get(thriftItem.getId());
|
199 |
snapdealItem = snapdealItemMap.get(thriftItem.getId());
|
| 198 |
maxnlcSD = snapdealItem.getMaxNlc();
|
200 |
maxnlcSD = snapdealItem.getMaxNlc();
|
| 199 |
}
|
201 |
}
|
| 200 |
if(flipkartItemMap.containsKey(thriftItem.getId())){
|
202 |
if(flipkartItemMap.containsKey(thriftItem.getId())){
|
| Line 261... |
Line 263... |
| 261 |
nlcLOISD.setOurNlc(maxnlcSD);
|
263 |
nlcLOISD.setOurNlc(maxnlcSD);
|
| 262 |
nlcLOISD.setSkuAtSource(snapdealItem.getSkuAtSnapdeal());
|
264 |
nlcLOISD.setSkuAtSource(snapdealItem.getSkuAtSnapdeal());
|
| 263 |
nlcLOISD.setVendorName(warehouse.getVendor().getName());
|
265 |
nlcLOISD.setVendorName(warehouse.getVendor().getName());
|
| 264 |
nlcLOISD.setVendorAvailability(available);
|
266 |
nlcLOISD.setVendorAvailability(available);
|
| 265 |
nlcLOISD.setVendorNlc(nlc);
|
267 |
nlcLOISD.setVendorNlc(nlc);
|
| 266 |
snapdealLeftInvDataMap.put(snapdealItem.getSkuAtSnapdeal()+warehouse.getId(), nlcLOISD);
|
268 |
nlcLOISD.setVendorWarehouseId(warehouse.getId());
|
| - |
|
269 |
nlcLoiSetSD.add(nlcLOISD);
|
| - |
|
270 |
|
| 267 |
}
|
271 |
}
|
| 268 |
}
|
272 |
}
|
| 269 |
}
|
273 |
}
|
| 270 |
|
274 |
|
| 271 |
if(flipkartItem!=null){
|
275 |
if(flipkartItem!=null){
|
| Line 294... |
Line 298... |
| 294 |
nlcLOIFK.setOurNlc(maxnlcFK);
|
298 |
nlcLOIFK.setOurNlc(maxnlcFK);
|
| 295 |
nlcLOIFK.setSkuAtSource(flipkartItem.getSkuAtFlipkart());
|
299 |
nlcLOIFK.setSkuAtSource(flipkartItem.getSkuAtFlipkart());
|
| 296 |
nlcLOIFK.setVendorName(warehouse.getVendor().getName());
|
300 |
nlcLOIFK.setVendorName(warehouse.getVendor().getName());
|
| 297 |
nlcLOIFK.setVendorAvailability(available);
|
301 |
nlcLOIFK.setVendorAvailability(available);
|
| 298 |
nlcLOIFK.setVendorNlc(nlc);
|
302 |
nlcLOIFK.setVendorNlc(nlc);
|
| 299 |
flipkartLeftInvDataMap.put(flipkartItem.getSkuAtFlipkart()+warehouse.getId(), nlcLOIFK);
|
303 |
nlcLOIFK.setVendorWarehouseId(warehouse.getId());
|
| - |
|
304 |
nlcLoiSetFK.add(nlcLOIFK);
|
| 300 |
}
|
305 |
}
|
| 301 |
}
|
306 |
}
|
| 302 |
}
|
307 |
}
|
| 303 |
//System.out.println("itemId:" + thriftItem.getId() + "\tmaxnlc: " + maxnlc + "\tnlc:" + nlc + "\twid:" + warehouse.getId() );
|
308 |
//System.out.println("itemId:" + thriftItem.getId() + "\tmaxnlc: " + maxnlc + "\tnlc:" + nlc + "\twid:" + warehouse.getId() );
|
| 304 |
|
309 |
|
| 305 |
}
|
310 |
}
|
| 306 |
}
|
311 |
}
|
| - |
|
312 |
snapdealLeftInvDataMap.put(snapdealItem.getSkuAtSnapdeal(), nlcLoiSetSD);
|
| - |
|
313 |
flipkartLeftInvDataMap.put(flipkartItem.getSkuAtFlipkart(), nlcLoiSetFK);
|
| 307 |
}
|
314 |
}
|
| 308 |
else{
|
315 |
else{
|
| 309 |
for (Map.Entry<Long,Long> entry : itemavailability.entrySet()) {
|
316 |
for (Map.Entry<Long,Long> entry : itemavailability.entrySet()) {
|
| 310 |
if(allWarehousesMap.get(entry.getKey()).getBillingWarehouseId()!=7){
|
317 |
if(allWarehousesMap.get(entry.getKey()).getBillingWarehouseId()!=7){
|
| 311 |
if(allWarehousesMap.get(entry.getKey()).getLogisticsLocation().equals(WarehouseLocation.Delhi) && allWarehousesMap.get(entry.getKey()).getWarehouseType().equals(WarehouseType.THIRD_PARTY) && allWarehousesMap.get(entry.getKey()).getVendor().getId()!=1){
|
318 |
if(allWarehousesMap.get(entry.getKey()).getLogisticsLocation().equals(WarehouseLocation.Delhi) && allWarehousesMap.get(entry.getKey()).getWarehouseType().equals(WarehouseType.THIRD_PARTY) && allWarehousesMap.get(entry.getKey()).getVendor().getId()!=1){
|
| Line 347... |
Line 354... |
| 347 |
nlcLOISD = new NlcLeftOutInventory();
|
354 |
nlcLOISD = new NlcLeftOutInventory();
|
| 348 |
nlcLOISD.setItemId(snapdealItem.getItem_id());
|
355 |
nlcLOISD.setItemId(snapdealItem.getItem_id());
|
| 349 |
nlcLOISD.setProductName(snapdealItem.getBrand()+" " +snapdealItem.getModel_name() + " "+ snapdealItem.getModel_number() + " " + snapdealItem.getColor());
|
356 |
nlcLOISD.setProductName(snapdealItem.getBrand()+" " +snapdealItem.getModel_name() + " "+ snapdealItem.getModel_number() + " " + snapdealItem.getColor());
|
| 350 |
nlcLOISD.setOurNlc(maxnlcSD);
|
357 |
nlcLOISD.setOurNlc(maxnlcSD);
|
| 351 |
nlcLOISD.setSkuAtSource(snapdealItem.getSkuAtSnapdeal());
|
358 |
nlcLOISD.setSkuAtSource(snapdealItem.getSkuAtSnapdeal());
|
| 352 |
nlcLOISD.setVendorName(vendorDataMap.get(entry.getKey()));
|
359 |
nlcLOISD.setVendorName(vendorDataMap.get(allWarehousesMap.get(entry.getKey()).getVendor().getId()));
|
| 353 |
nlcLOISD.setVendorAvailability(available);
|
360 |
nlcLOISD.setVendorAvailability(available);
|
| 354 |
nlcLOISD.setVendorNlc(nlc);
|
361 |
nlcLOISD.setVendorNlc(nlc);
|
| 355 |
snapdealLeftInvDataMap.put(snapdealItem.getSkuAtSnapdeal()+entry.getKey(), nlcLOISD);
|
362 |
nlcLoiSetSD.add(nlcLOISD);
|
| 356 |
}
|
363 |
}
|
| 357 |
}
|
364 |
}
|
| 358 |
}
|
365 |
}
|
| 359 |
|
366 |
|
| 360 |
if(flipkartItem!=null){
|
367 |
if(flipkartItem!=null){
|
| Line 380... |
Line 387... |
| 380 |
nlcLOIFK = new NlcLeftOutInventory();
|
387 |
nlcLOIFK = new NlcLeftOutInventory();
|
| 381 |
nlcLOIFK.setItemId(flipkartItem.getItem_id());
|
388 |
nlcLOIFK.setItemId(flipkartItem.getItem_id());
|
| 382 |
nlcLOIFK.setProductName(thriftItem.getBrand()+" " +thriftItem.getModelName() + " "+ thriftItem.getModelNumber() + " " + thriftItem.getColor());
|
389 |
nlcLOIFK.setProductName(thriftItem.getBrand()+" " +thriftItem.getModelName() + " "+ thriftItem.getModelNumber() + " " + thriftItem.getColor());
|
| 383 |
nlcLOIFK.setOurNlc(maxnlcFK);
|
390 |
nlcLOIFK.setOurNlc(maxnlcFK);
|
| 384 |
nlcLOIFK.setSkuAtSource(flipkartItem.getSkuAtFlipkart());
|
391 |
nlcLOIFK.setSkuAtSource(flipkartItem.getSkuAtFlipkart());
|
| 385 |
nlcLOIFK.setVendorName(vendorDataMap.get(entry.getKey()));
|
392 |
nlcLOIFK.setVendorName(vendorDataMap.get(allWarehousesMap.get(entry.getKey()).getVendor().getId()));
|
| 386 |
nlcLOIFK.setVendorAvailability(available);
|
393 |
nlcLOIFK.setVendorAvailability(available);
|
| 387 |
nlcLOIFK.setVendorNlc(nlc);
|
394 |
nlcLOIFK.setVendorNlc(nlc);
|
| 388 |
flipkartLeftInvDataMap.put(flipkartItem.getSkuAtFlipkart()+entry.getKey(), nlcLOIFK);
|
395 |
nlcLoiSetFK.add(nlcLOIFK);
|
| 389 |
}
|
396 |
}
|
| 390 |
}
|
397 |
}
|
| 391 |
}
|
398 |
}
|
| 392 |
|
399 |
|
| 393 |
|
400 |
|
| 394 |
}
|
401 |
}
|
| 395 |
}
|
402 |
}
|
| - |
|
403 |
snapdealLeftInvDataMap.put(snapdealItem.getSkuAtSnapdeal(), nlcLoiSetSD);
|
| - |
|
404 |
flipkartLeftInvDataMap.put(flipkartItem.getSkuAtFlipkart(), nlcLoiSetFK);
|
| 396 |
}
|
405 |
}
|
| 397 |
|
406 |
|
| 398 |
Map<Long,Long> itemreserve = new HashMap<Long,Long>();
|
407 |
Map<Long,Long> itemreserve = new HashMap<Long,Long>();
|
| 399 |
itemreserve = iteminventory.getReserved();
|
408 |
itemreserve = iteminventory.getReserved();
|
| 400 |
if (thriftItem.isIsWarehousePreferenceSticky() && thriftItem.getPreferredVendor()!=0){
|
409 |
if (thriftItem.isIsWarehousePreferenceSticky() && thriftItem.getPreferredVendor()!=0){
|
| Line 425... |
Line 434... |
| 425 |
//reserve = reserve + itemreserve.get(warehouse.getId());
|
434 |
//reserve = reserve + itemreserve.get(warehouse.getId());
|
| 426 |
//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\treserve:" + reserve);
|
435 |
//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\treserve:" + reserve);
|
| 427 |
//continue;
|
436 |
//continue;
|
| 428 |
}
|
437 |
}
|
| 429 |
else{
|
438 |
else{
|
| 430 |
if(snapdealLeftInvDataMap.containsKey(snapdealItem.getSkuAtSnapdeal()+warehouse.getId())){
|
439 |
if(snapdealLeftInvDataMap.containsKey(snapdealItem.getSkuAtSnapdeal())){
|
| 431 |
NlcLeftOutInventory newObj = snapdealLeftInvDataMap.get(snapdealItem.getSkuAtSnapdeal()+warehouse.getId());
|
440 |
Set<NlcLeftOutInventory> newNlcObjSet = snapdealLeftInvDataMap.get(snapdealItem.getSkuAtSnapdeal());
|
| - |
|
441 |
Iterator<NlcLeftOutInventory> it = newNlcObjSet.iterator();
|
| - |
|
442 |
int i=0;
|
| - |
|
443 |
while(it.hasNext()){
|
| - |
|
444 |
NlcLeftOutInventory newObj = it.next();
|
| - |
|
445 |
if(newObj.getVendorWarehouseId()==warehouse.getId()){
|
| 432 |
newObj.setReserved(itemreserve.get(warehouse.getId()));
|
446 |
newObj.setReserved(itemreserve.get(warehouse.getId()));
|
| 433 |
newObj.setTotalAvailability(newObj.getVendorAvailability()-itemreserve.get(warehouse.getId()));
|
447 |
newObj.setTotalAvailability(newObj.getVendorAvailability()-itemreserve.get(warehouse.getId()));
|
| - |
|
448 |
newNlcObjSet.remove(i);
|
| 434 |
snapdealLeftInvDataMap.put(snapdealItem.getSkuAtSnapdeal()+warehouse.getId(), newObj);
|
449 |
newNlcObjSet.add(newObj);
|
| - |
|
450 |
}
|
| - |
|
451 |
i++;
|
| - |
|
452 |
}
|
| - |
|
453 |
|
| - |
|
454 |
nlcLoiSetSD = newNlcObjSet;
|
| 435 |
}
|
455 |
}
|
| 436 |
}
|
456 |
}
|
| 437 |
}
|
457 |
}
|
| 438 |
|
458 |
|
| 439 |
if(flipkartItem!=null){
|
459 |
if(flipkartItem!=null){
|
| Line 446... |
Line 466... |
| 446 |
//reserve = reserve + itemreserve.get(warehouse.getId());
|
466 |
//reserve = reserve + itemreserve.get(warehouse.getId());
|
| 447 |
//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\treserve:" + reserve);
|
467 |
//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\treserve:" + reserve);
|
| 448 |
//continue;
|
468 |
//continue;
|
| 449 |
}
|
469 |
}
|
| 450 |
else{
|
470 |
else{
|
| 451 |
if(flipkartLeftInvDataMap.containsKey(flipkartItem.getSkuAtFlipkart()+warehouse.getId())){
|
471 |
if(flipkartLeftInvDataMap.containsKey(flipkartItem.getSkuAtFlipkart())){
|
| 452 |
NlcLeftOutInventory newObj = flipkartLeftInvDataMap.get(flipkartItem.getSkuAtFlipkart()+warehouse.getId());
|
472 |
Set<NlcLeftOutInventory> newNlcObjSet = flipkartLeftInvDataMap.get(flipkartItem.getSkuAtFlipkart());
|
| - |
|
473 |
Iterator<NlcLeftOutInventory> it = newNlcObjSet.iterator();
|
| - |
|
474 |
int i=0;
|
| - |
|
475 |
while(it.hasNext()){
|
| - |
|
476 |
NlcLeftOutInventory newObj = it.next();
|
| - |
|
477 |
if(newObj.getVendorWarehouseId()==warehouse.getId()){
|
| 453 |
newObj.setReserved(itemreserve.get(warehouse.getId()));
|
478 |
newObj.setReserved(itemreserve.get(warehouse.getId()));
|
| 454 |
newObj.setTotalAvailability(newObj.getVendorAvailability()-itemreserve.get(warehouse.getId()));
|
479 |
newObj.setTotalAvailability(newObj.getVendorAvailability()-itemreserve.get(warehouse.getId()));
|
| - |
|
480 |
newNlcObjSet.remove(i);
|
| 455 |
flipkartLeftInvDataMap.put(flipkartItem.getSkuAtFlipkart()+warehouse.getId(), newObj);
|
481 |
newNlcObjSet.add(newObj);
|
| - |
|
482 |
}
|
| - |
|
483 |
i++;
|
| - |
|
484 |
}
|
| - |
|
485 |
|
| - |
|
486 |
nlcLoiSetFK = newNlcObjSet;
|
| 456 |
}
|
487 |
}
|
| 457 |
}
|
488 |
}
|
| 458 |
}
|
489 |
}
|
| 459 |
|
490 |
|
| 460 |
|
491 |
|
| 461 |
}
|
492 |
}
|
| 462 |
}
|
493 |
}
|
| - |
|
494 |
|
| - |
|
495 |
snapdealLeftInvDataMap.put(snapdealItem.getSkuAtSnapdeal(), nlcLoiSetSD);
|
| - |
|
496 |
flipkartLeftInvDataMap.put(flipkartItem.getSkuAtFlipkart(), nlcLoiSetFK);
|
| - |
|
497 |
|
| 463 |
}else{
|
498 |
}else{
|
| 464 |
for (Map.Entry<Long,Long> entry : itemreserve.entrySet()) {
|
499 |
for (Map.Entry<Long,Long> entry : itemreserve.entrySet()) {
|
| 465 |
if(allWarehousesMap.get(entry.getKey()).getBillingWarehouseId()!=7){
|
500 |
if(allWarehousesMap.get(entry.getKey()).getBillingWarehouseId()!=7){
|
| 466 |
if(allWarehousesMap.get(entry.getKey()).getLogisticsLocation().equals(WarehouseLocation.Delhi) && allWarehousesMap.get(entry.getKey()).getWarehouseType().equals(WarehouseType.THIRD_PARTY) && allWarehousesMap.get(entry.getKey()).getVendor().getId()!=1){
|
501 |
if(allWarehousesMap.get(entry.getKey()).getLogisticsLocation().equals(WarehouseLocation.Delhi) && allWarehousesMap.get(entry.getKey()).getWarehouseType().equals(WarehouseType.THIRD_PARTY) && allWarehousesMap.get(entry.getKey()).getVendor().getId()!=1){
|
| 467 |
|
502 |
|
| Line 486... |
Line 521... |
| 486 |
//reserve = reserve + entry.getValue();
|
521 |
//reserve = reserve + entry.getValue();
|
| 487 |
//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\treserve:" + reserve);
|
522 |
//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\treserve:" + reserve);
|
| 488 |
//continue;
|
523 |
//continue;
|
| 489 |
}
|
524 |
}
|
| 490 |
else{
|
525 |
else{
|
| 491 |
if(snapdealLeftInvDataMap.containsKey(snapdealItem.getSkuAtSnapdeal()+entry.getKey())){
|
526 |
if(snapdealLeftInvDataMap.containsKey(snapdealItem.getSkuAtSnapdeal())){
|
| 492 |
NlcLeftOutInventory newObj = snapdealLeftInvDataMap.get(snapdealItem.getSkuAtSnapdeal()+entry.getKey());
|
527 |
Set<NlcLeftOutInventory> newNlcObjSet = snapdealLeftInvDataMap.get(snapdealItem.getSkuAtSnapdeal());
|
| - |
|
528 |
Iterator<NlcLeftOutInventory> it = newNlcObjSet.iterator();
|
| - |
|
529 |
int i=0;
|
| - |
|
530 |
while(it.hasNext()){
|
| - |
|
531 |
NlcLeftOutInventory newObj = it.next();
|
| - |
|
532 |
if(newObj.getVendorWarehouseId()==entry.getKey()){
|
| 493 |
newObj.setReserved(itemreserve.get(entry.getKey()));
|
533 |
newObj.setReserved(itemreserve.get(entry.getKey()));
|
| 494 |
newObj.setTotalAvailability(newObj.getVendorAvailability()-itemreserve.get(entry.getKey()));
|
534 |
newObj.setTotalAvailability(newObj.getVendorAvailability()-itemreserve.get(entry.getKey()));
|
| - |
|
535 |
newNlcObjSet.remove(i);
|
| 495 |
snapdealLeftInvDataMap.put(snapdealItem.getSkuAtSnapdeal()+entry.getKey(), newObj);
|
536 |
newNlcObjSet.add(newObj);
|
| - |
|
537 |
}
|
| - |
|
538 |
i++;
|
| - |
|
539 |
}
|
| - |
|
540 |
|
| - |
|
541 |
nlcLoiSetSD = newNlcObjSet;
|
| 496 |
}
|
542 |
}
|
| 497 |
}
|
543 |
}
|
| 498 |
}
|
544 |
}
|
| 499 |
if(flipkartItem!=null){
|
545 |
if(flipkartItem!=null){
|
| 500 |
if(nlc !=0 && (maxnlcFK >= nlc)){
|
546 |
if(nlc !=0 && (maxnlcFK >= nlc)){
|
| Line 506... |
Line 552... |
| 506 |
//reserve = reserve + entry.getValue();
|
552 |
//reserve = reserve + entry.getValue();
|
| 507 |
//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\treserve:" + reserve);
|
553 |
//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\treserve:" + reserve);
|
| 508 |
//continue;
|
554 |
//continue;
|
| 509 |
}
|
555 |
}
|
| 510 |
else{
|
556 |
else{
|
| 511 |
if(flipkartLeftInvDataMap.containsKey(flipkartItem.getSkuAtFlipkart()+entry.getKey())){
|
557 |
if(flipkartLeftInvDataMap.containsKey(flipkartItem.getSkuAtFlipkart())){
|
| 512 |
NlcLeftOutInventory newObj = flipkartLeftInvDataMap.get(flipkartItem.getSkuAtFlipkart()+entry.getKey());
|
558 |
Set<NlcLeftOutInventory> newNlcObjSet = flipkartLeftInvDataMap.get(flipkartItem.getSkuAtFlipkart());
|
| - |
|
559 |
Iterator<NlcLeftOutInventory> it = newNlcObjSet.iterator();
|
| - |
|
560 |
int i=0;
|
| - |
|
561 |
while(it.hasNext()){
|
| - |
|
562 |
NlcLeftOutInventory newObj = it.next();
|
| - |
|
563 |
if(newObj.getVendorWarehouseId()==entry.getKey()){
|
| 513 |
newObj.setReserved(itemreserve.get(entry.getKey()));
|
564 |
newObj.setReserved(itemreserve.get(entry.getKey()));
|
| 514 |
newObj.setTotalAvailability(newObj.getVendorAvailability()-itemreserve.get(entry.getKey()));
|
565 |
newObj.setTotalAvailability(newObj.getVendorAvailability()-itemreserve.get(entry.getKey()));
|
| - |
|
566 |
newNlcObjSet.remove(i);
|
| 515 |
flipkartLeftInvDataMap.put(flipkartItem.getSkuAtFlipkart()+entry.getKey(), newObj);
|
567 |
newNlcObjSet.add(newObj);
|
| - |
|
568 |
}
|
| - |
|
569 |
i++;
|
| - |
|
570 |
}
|
| - |
|
571 |
|
| - |
|
572 |
nlcLoiSetFK = newNlcObjSet;
|
| 516 |
}
|
573 |
}
|
| 517 |
}
|
574 |
}
|
| 518 |
}
|
575 |
}
|
| 519 |
|
576 |
|
| 520 |
}
|
577 |
}
|
| 521 |
|
578 |
|
| 522 |
else{
|
579 |
else{
|
| 523 |
//System.out.println("skipping inventory for warehouse id " + entry.getKey());
|
580 |
//System.out.println("skipping inventory for warehouse id " + entry.getKey());
|
| 524 |
}
|
581 |
}
|
| 525 |
}
|
582 |
}
|
| - |
|
583 |
|
| - |
|
584 |
snapdealLeftInvDataMap.put(snapdealItem.getSkuAtSnapdeal(), nlcLoiSetSD);
|
| - |
|
585 |
flipkartLeftInvDataMap.put(flipkartItem.getSkuAtFlipkart(), nlcLoiSetFK);
|
| 526 |
}
|
586 |
}
|
| 527 |
|
587 |
|
| 528 |
|
588 |
|
| 529 |
}
|
589 |
}
|
| 530 |
|
590 |
|
| 531 |
for (Map.Entry<String,NlcLeftOutInventory> entry : snapdealLeftInvDataMap.entrySet()){
|
591 |
for (Map.Entry<String,Set<NlcLeftOutInventory>> entry : snapdealLeftInvDataMap.entrySet()){
|
| - |
|
592 |
for(NlcLeftOutInventory nlcLOI : entry.getValue()){
|
| 532 |
nlcLeftOutInventoryItemsSD.add(snapdealLeftInvDataMap.get(entry.getKey()));
|
593 |
nlcLeftOutInventoryItemsSD.add(nlcLOI);
|
| - |
|
594 |
}
|
| 533 |
}
|
595 |
}
|
| 534 |
for (Map.Entry<String,NlcLeftOutInventory> entry : flipkartLeftInvDataMap.entrySet()){
|
596 |
for (Map.Entry<String,Set<NlcLeftOutInventory>> entry : flipkartLeftInvDataMap.entrySet()){
|
| - |
|
597 |
for(NlcLeftOutInventory nlcLOI : entry.getValue()){
|
| 535 |
nlcLeftOutInventoryItemsFK.add(flipkartLeftInvDataMap.get(entry.getKey()));
|
598 |
nlcLeftOutInventoryItemsFK.add(nlcLOI);
|
| - |
|
599 |
}
|
| 536 |
}
|
600 |
}
|
| 537 |
|
601 |
|
| 538 |
}
|
602 |
}
|
| 539 |
} catch (TException e) {
|
603 |
} catch (TException e) {
|
| 540 |
// TODO Auto-generated catch block
|
604 |
// TODO Auto-generated catch block
|
| Line 578... |
Line 642... |
| 578 |
bufferedWriter.close();
|
642 |
bufferedWriter.close();
|
| 579 |
|
643 |
|
| 580 |
List<File> files = new ArrayList<File>();
|
644 |
List<File> files = new ArrayList<File>();
|
| 581 |
files.add(file);
|
645 |
files.add(file);
|
| 582 |
|
646 |
|
| 583 |
mailer.sendSSLMessage(sendTo, "Inventory not Sent due to NLC Limitaion in case of - "+ fileName , "Please find attached file.", emailFromAddress, password, files);
|
647 |
//mailer.sendSSLMessage(sendTo, "Inventory not Sent due to NLC Limitaion in case of - "+ fileName , "Please find attached file.", emailFromAddress, password, files);
|
| 584 |
} catch (Exception e) {
|
648 |
} catch (Exception e) {
|
| 585 |
e.printStackTrace();
|
649 |
e.printStackTrace();
|
| 586 |
try {
|
650 |
/*try {
|
| 587 |
mailer.sendSSLMessage(sendTo,"Error while creating file from data ", emailFromAddress, password, "");
|
651 |
//mailer.sendSSLMessage(sendTo,"Error while creating file from data ", emailFromAddress, password, "");
|
| 588 |
} catch (MessagingException e1) {
|
652 |
} catch (MessagingException e1) {
|
| 589 |
e1.printStackTrace();
|
653 |
e1.printStackTrace();
|
| 590 |
}
|
654 |
}*/
|
| 591 |
}
|
655 |
}
|
| 592 |
}
|
656 |
}
|
| 593 |
|
657 |
|
| 594 |
//private static DefaultHttpClient client = new DefaultHttpClient();
|
658 |
//private static DefaultHttpClient client = new DefaultHttpClient();
|
| 595 |
|
659 |
|