Subversion Repositories SmartDukaan

Rev

Rev 9538 | Rev 9540 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9538 Rev 9539
Line 95... Line 95...
95
		}
95
		}
96
		in.shop2020.model.v1.order.TransactionService.Client transactionClient = null;
96
		in.shop2020.model.v1.order.TransactionService.Client transactionClient = null;
97
		try {
97
		try {
98
			transactionClient = new TransactionClient("support_transaction_service_server_host","transaction_service_server_port").getClient();
98
			transactionClient = new TransactionClient("support_transaction_service_server_host","transaction_service_server_port").getClient();
99
			lastUpdatedInventoryTime = transactionClient.getSourceDetail(7).getLastUpdatedOn();
99
			lastUpdatedInventoryTime = transactionClient.getSourceDetail(7).getLastUpdatedOn();
100
			System.out.println("Time is " + lastUpdatedInventoryTime);
100
			//System.out.println("Time is " + lastUpdatedInventoryTime);
101
		} catch (Exception e) {
101
		} catch (Exception e) {
102
			try {
102
			try {
103
				transactionClient = new TransactionClient("support_transaction_service_server_host","transaction_service_server_port").getClient();
103
				transactionClient = new TransactionClient("support_transaction_service_server_host","transaction_service_server_port").getClient();
104
				lastUpdatedInventoryTime = transactionClient.getSourceDetail(7).getLastUpdatedOn();
104
				lastUpdatedInventoryTime = transactionClient.getSourceDetail(7).getLastUpdatedOn();
105
			} catch (Exception ex) {
105
			} catch (Exception ex) {
Line 313... Line 313...
313
								//System.out.println("skipping inventory for warehouse id " + entry.getKey());
313
								//System.out.println("skipping inventory for warehouse id " + entry.getKey());
314
							}
314
							}
315
						}
315
						}
316
					}
316
					}
317
					item= new SnapdealItemForInventory(thriftItem.getId(),available,reserve,heldForSource,thriftItem.getHoldInventory(),thriftItem.getDefaultInventory(),total_held,thriftItem.isRisky(),thriftItem.getItemStatus());
317
					item= new SnapdealItemForInventory(thriftItem.getId(),available,reserve,heldForSource,thriftItem.getHoldInventory(),thriftItem.getDefaultInventory(),total_held,thriftItem.isRisky(),thriftItem.getItemStatus());
318
					System.out.println("itemId:" + thriftItem.getId() + "\tavailable: " + available + "\treserve" + reserve + "\theldForSource:" + heldForSource + "\twebsite_hold:" + thriftItem.getHoldInventory() + "\tdefault_inv:" +thriftItem.getDefaultInventory());
318
					//System.out.println("itemId:" + thriftItem.getId() + "\tavailable: " + available + "\treserve" + reserve + "\theldForSource:" + heldForSource + "\twebsite_hold:" + thriftItem.getHoldInventory() + "\tdefault_inv:" +thriftItem.getDefaultInventory());
319
				}
319
				}
320
				else{
320
				else{
321
					item = new SnapdealItemForInventory(thriftItem.getId(),0,0,0,thriftItem.getHoldInventory(),thriftItem.getDefaultInventory(),0,thriftItem.isRisky(),thriftItem.getItemStatus());
321
					item = new SnapdealItemForInventory(thriftItem.getId(),0,0,0,thriftItem.getHoldInventory(),thriftItem.getDefaultInventory(),0,thriftItem.isRisky(),thriftItem.getItemStatus());
322
					System.out.println("itemId:" + thriftItem.getId() + "\tavailable: " + available + "\treserve" + reserve + "\theldForSource:" + heldForSource + "\twebsite_hold:" + thriftItem.getHoldInventory() + "\tdefault_inv:" +thriftItem.getDefaultInventory());
322
					//System.out.println("itemId:" + thriftItem.getId() + "\tavailable: " + available + "\treserve" + reserve + "\theldForSource:" + heldForSource + "\twebsite_hold:" + thriftItem.getHoldInventory() + "\tdefault_inv:" +thriftItem.getDefaultInventory());
323
				}
323
				}
324
 
324
 
325
				//System.out.println(" Item details are " + thriftItem.getId() +" " + available + " " + reserve + " " + thriftItem.getHoldInventory() + " "+ thriftItem.getDefaultInventory() + " " + thriftItem.isRisky());
325
				//System.out.println(" Item details are " + thriftItem.getId() +" " + available + " " + reserve + " " + thriftItem.getHoldInventory() + " "+ thriftItem.getDefaultInventory() + " " + thriftItem.isRisky());
326
				//System.out.println("+++++++++++++++++++++++");
326
				//System.out.println("+++++++++++++++++++++++");
327
				allItemsInventoryMap.put(thriftItem.getId(),item);
327
				allItemsInventoryMap.put(thriftItem.getId(),item);
Line 667... Line 667...
667
					heldorders = itemIdpendingOrdersMap.get(sku);
667
					heldorders = itemIdpendingOrdersMap.get(sku);
668
					if(heldorders < 0){
668
					if(heldorders < 0){
669
						heldorders = 0;
669
						heldorders = 0;
670
					}
670
					}
671
				}
671
				}
672
				System.out.println("itemId: " + inventoryItem.getId() + "\trisky: " + inventoryItem.getRisky()+ "\tavailable: " + inventoryItem.getAvailability() + "\treserve: " + inventoryItem.getReserve() + "\theldForSource:" + inventoryItem.getHeldForSource() + "\twebsite_hold: " + inventoryItem.getHoldInventory() + "\tdefault_inv: " +inventoryItem.getDefaultInventory() + "\theldorders " + heldorders);
672
				System.out.println("itemId: " + inventoryItem.getId() + "\trisky: " + inventoryItem.getRisky()+ 
-
 
673
						"\tavailable: " + available + "\treserve: " + reserve + "\theldForSource:" + heldforsource +
-
 
674
						"\twebsite_hold: " + holdinventory + "\total_held: " +totalheld +"\tdefault_inv: "
-
 
675
						+ defaultinventory + "\theldorders " + heldorders);
673
				row =   sheet.getRow((short) iterator);
676
				row =   sheet.getRow((short) iterator);
674
				
677
				
675
				if(inventoryItem.getRisky()){
678
				if(inventoryItem.getRisky()){
676
					allocable = available - reserve - totalheld - holdinventory;
679
					allocable = available - reserve - totalheld - holdinventory;
677
					if(allocable < 0){
680
					if(allocable < 0){
678
						allocable = 0;
681
						allocable = 0;
679
					}
682
					}
680
					sent_inventory = Math.round(allocable*2/3) + heldforsource - heldorders ;
683
					sent_inventory = Math.round(allocable*2/3) + heldforsource - heldorders ;
681
					System.out.println("allocable" + allocable + "\t2/3allocable" + Math.round(allocable*2/3) +  "\theld for source" + heldforsource + "\ttotal held" + totalheld +"\theldorders" +  heldorders + "\tFinal Value is : " + (Math.round(allocable*2/3) +  heldforsource - heldorders));
684
					//System.out.println("allocable" + allocable + "\t2/3allocable" + Math.round(allocable*2/3) +  "\theld for source" + heldforsource + "\ttotal held" + totalheld +"\theldorders" +  heldorders + "\tFinal Value is : " + (Math.round(allocable*2/3) +  heldforsource - heldorders));
682
					if(sent_inventory < 0){
685
					if(sent_inventory < 0){
683
						sent_inventory = 0;
686
						sent_inventory = 0;
684
					}
687
					}
685
				}
688
				}
686
				else{
689
				else{
Line 688... Line 691...
688
					if(allocable < 0){
691
					if(allocable < 0){
689
						allocable = 0;
692
						allocable = 0;
690
					}
693
					}
691
					if((allocable + heldforsource ) > defaultinventory){
694
					if((allocable + heldforsource ) > defaultinventory){
692
						sent_inventory = Math.round(allocable*2/3) +  heldforsource - heldorders;
695
						sent_inventory = Math.round(allocable*2/3) +  heldforsource - heldorders;
693
						System.out.println("actual" + allocable + "\t2/3actual" + Math.round(allocable*2/3) +  "\theld for source" + heldforsource + "\theldorders" +  heldorders + "\tFinal Value is : " + (Math.round(allocable*2/3) +  heldforsource - heldorders));
696
						//System.out.println("actual" + allocable + "\t2/3actual" + Math.round(allocable*2/3) +  "\theld for source" + heldforsource + "\theldorders" +  heldorders + "\tFinal Value is : " + (Math.round(allocable*2/3) +  heldforsource - heldorders));
694
						if(sent_inventory < 0){
697
						if(sent_inventory < 0){
695
							sent_inventory = 0;							
698
							sent_inventory = 0;							
696
						}
699
						}
697
					}
700
					}
698
					else{
701
					else{
Line 739... Line 742...
739
				"yukti.jain@shop2020.in","manisha.sharma@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
742
				"yukti.jain@shop2020.in","manisha.sharma@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
740
		if(iterator > 1){
743
		if(iterator > 1){
741
			FileOutputStream fileOut = null;
744
			FileOutputStream fileOut = null;
742
			fis.close();
745
			fis.close();
743
			try {
746
			try {
744
				System.out.println("Before writing file ");
747
				//System.out.println("Before writing file ");
745
				fileOut = new FileOutputStream(SNAPDEAL_INVENTORY_SHEET);
748
				fileOut = new FileOutputStream(SNAPDEAL_INVENTORY_SHEET);
746
			} catch (FileNotFoundException e) {
749
			} catch (FileNotFoundException e) {
747
				// TODO Auto-generated catch block
750
				// TODO Auto-generated catch block
748
				e.printStackTrace();
751
				e.printStackTrace();
749
			}
752
			}