| Line 839... |
Line 839... |
| 839 |
}
|
839 |
}
|
| 840 |
else{
|
840 |
else{
|
| 841 |
continue;
|
841 |
continue;
|
| 842 |
}
|
842 |
}
|
| 843 |
}
|
843 |
}
|
| - |
|
844 |
|
| 844 |
if(!UPDATEUSINGPANEL){
|
845 |
if(iterator > 1){
|
| 845 |
if(iterator > 1){
|
846 |
if(!UPDATEUSINGPANEL){
|
| 846 |
FileOutputStream fileOut = null;
|
847 |
FileOutputStream fileOut = null;
|
| 847 |
fis.close();
|
848 |
fis.close();
|
| 848 |
try {
|
849 |
try {
|
| 849 |
System.out.println("Before writing file ");
|
850 |
System.out.println("Before writing file ");
|
| 850 |
fileOut = new FileOutputStream(SNAPDEAL_INVENTORY_SHEET);
|
851 |
fileOut = new FileOutputStream(SNAPDEAL_INVENTORY_SHEET);
|
| Line 882... |
Line 883... |
| 882 |
}
|
883 |
}
|
| 883 |
} catch (IOException e) {
|
884 |
} catch (IOException e) {
|
| 884 |
e.printStackTrace();
|
885 |
e.printStackTrace();
|
| 885 |
}
|
886 |
}
|
| 886 |
System.out.println("posting response" + feedresponse);
|
887 |
System.out.println("posting response" + feedresponse);
|
| 887 |
}
|
888 |
}
|
| - |
|
889 |
}
|
| - |
|
890 |
else{
|
| - |
|
891 |
try {
|
| - |
|
892 |
mailer.sendSSLMessage(sendTo,"No changes in Snapdeal inventory to update "+ sdf.format(System.currentTimeMillis()),"No change in Snapdeal Inventory to be updated ", emailFromAddress, password, new ArrayList<File>());
|
| - |
|
893 |
} catch (MessagingException e) {
|
| - |
|
894 |
e.printStackTrace();
|
| - |
|
895 |
}
|
| - |
|
896 |
}
|
| 888 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = null;
|
897 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = null;
|
| 889 |
long lastSentInventoryTime = System.currentTimeMillis();
|
898 |
long lastSentInventoryTime = System.currentTimeMillis();
|
| - |
|
899 |
try {
|
| - |
|
900 |
transactionClient = new TransactionClient("support_transaction_service_server_host","transaction_service_server_port").getClient();
|
| - |
|
901 |
transactionClient.updateSourceDetailTimestamp(7, lastSentInventoryTime);
|
| - |
|
902 |
} catch (Exception e) {
|
| 890 |
try {
|
903 |
try {
|
| 891 |
transactionClient = new TransactionClient("support_transaction_service_server_host","transaction_service_server_port").getClient();
|
904 |
transactionClient = new TransactionClient("support_transaction_service_server_host","transaction_service_server_port").getClient();
|
| 892 |
transactionClient.updateSourceDetailTimestamp(7, lastSentInventoryTime);
|
905 |
transactionClient.updateSourceDetailTimestamp(7, lastSentInventoryTime);
|
| 893 |
} catch (Exception e) {
|
- |
|
| 894 |
try {
|
- |
|
| 895 |
transactionClient = new TransactionClient("support_transaction_service_server_host","transaction_service_server_port").getClient();
|
- |
|
| 896 |
transactionClient.updateSourceDetailTimestamp(7, lastSentInventoryTime);
|
- |
|
| 897 |
} catch (Exception ex) {
|
906 |
} catch (Exception ex) {
|
| 898 |
ex.printStackTrace();
|
907 |
ex.printStackTrace();
|
| 899 |
}
|
- |
|
| 900 |
}
|
- |
|
| 901 |
String emailSubjectTxt;
|
- |
|
| 902 |
if(UPDATEUSINGPANEL){
|
- |
|
| 903 |
emailSubjectTxt = "Products back in stock on Snapdeal (Using Panel) "+sdf.format(lastSentInventoryTime);
|
- |
|
| 904 |
}
|
- |
|
| 905 |
else{
|
- |
|
| 906 |
emailSubjectTxt = "Products back in stock on Snapdeal "+sdf.format(lastSentInventoryTime);
|
- |
|
| 907 |
}
|
908 |
}
|
| - |
|
909 |
}
|
| - |
|
910 |
String emailSubjectTxt;
|
| - |
|
911 |
if(UPDATEUSINGPANEL){
|
| - |
|
912 |
emailSubjectTxt = "Products back in stock on Snapdeal (Using Panel) "+sdf.format(lastSentInventoryTime);
|
| - |
|
913 |
}
|
| - |
|
914 |
else{
|
| - |
|
915 |
emailSubjectTxt = "Products back in stock on Snapdeal "+sdf.format(lastSentInventoryTime);
|
| - |
|
916 |
}
|
| 908 |
|
917 |
|
| 909 |
String text;
|
918 |
String text;
|
| 910 |
String tableHeader = "<tr>"
|
919 |
String tableHeader = "<tr>"
|
| 911 |
+ "<td>" + "Product Name" +"</td>"
|
920 |
+ "<td>" + "Product Name" +"</td>"
|
| 912 |
+"<td>" + "Item ID" + "</td>"
|
921 |
+"<td>" + "Item ID" + "</td>"
|
| 913 |
+"<td>" + "Old Inventory" + "</td>"
|
922 |
+"<td>" + "Old Inventory" + "</td>"
|
| 914 |
+"<td>" + "New Inventory" + "</td>"
|
923 |
+"<td>" + "New Inventory" + "</td>"
|
| 915 |
+"</tr>";
|
924 |
+"</tr>";
|
| 916 |
if(backInStockItems.length() > 0){
|
925 |
if(backInStockItems.length() > 0){
|
| 917 |
text = "<html><table border=\"1\" align=\"center\">"+tableHeader+backInStockItems.toString()+"</table></html>";
|
926 |
text = "<html><table border=\"1\" align=\"center\">"+tableHeader+backInStockItems.toString()+"</table></html>";
|
| 918 |
try {
|
927 |
try {
|
| 919 |
mailer.sendSSLMessage(sendTo,emailSubjectTxt, emailFromAddress, password, text);
|
928 |
mailer.sendSSLMessage(sendTo,emailSubjectTxt, emailFromAddress, password, text);
|
| 920 |
//mailer.sendSSLMessage(sendTo, emailSubjectTxt, text, emailFromAddress, password, new ArrayList<File>());
|
929 |
//mailer.sendSSLMessage(sendTo, emailSubjectTxt, text, emailFromAddress, password, new ArrayList<File>());
|
| 921 |
} catch (MessagingException e) {
|
930 |
} catch (MessagingException e) {
|
| 922 |
e.printStackTrace();
|
931 |
e.printStackTrace();
|
| 923 |
}
|
- |
|
| 924 |
}
|
- |
|
| 925 |
if(UPDATEUSINGPANEL){
|
- |
|
| 926 |
emailSubjectTxt = "Products back in stock on Snapdeal (Using Panel) "+sdf.format(lastSentInventoryTime);
|
- |
|
| 927 |
}
|
- |
|
| 928 |
else{
|
- |
|
| 929 |
emailSubjectTxt = "Products out of stock on Snapdeal "+sdf.format(lastSentInventoryTime);
|
- |
|
| 930 |
}
|
932 |
}
|
| - |
|
933 |
}
|
| - |
|
934 |
if(UPDATEUSINGPANEL){
|
| - |
|
935 |
emailSubjectTxt = "Products back in stock on Snapdeal (Using Panel) "+sdf.format(lastSentInventoryTime);
|
| - |
|
936 |
}
|
| - |
|
937 |
else{
|
| - |
|
938 |
emailSubjectTxt = "Products out of stock on Snapdeal "+sdf.format(lastSentInventoryTime);
|
| - |
|
939 |
}
|
| 931 |
if(outOfStockItems.length() > 0){
|
940 |
if(outOfStockItems.length() > 0){
|
| 932 |
text = "<html><table border=\"1\" align=\"center\">"+tableHeader+outOfStockItems.toString()+"</table></html>";
|
941 |
text = "<html><table border=\"1\" align=\"center\">"+tableHeader+outOfStockItems.toString()+"</table></html>";
|
| 933 |
try {
|
942 |
try {
|
| 934 |
mailer.sendSSLMessage(sendTo,emailSubjectTxt, emailFromAddress, password, text);
|
943 |
mailer.sendSSLMessage(sendTo,emailSubjectTxt, emailFromAddress, password, text);
|
| 935 |
//mailer.sendSSLMessage(sendTo, emailSubjectTxt, text, emailFromAddress, password, new ArrayList<File>());
|
944 |
//mailer.sendSSLMessage(sendTo, emailSubjectTxt, text, emailFromAddress, password, new ArrayList<File>());
|
| 936 |
} catch (MessagingException e) {
|
945 |
} catch (MessagingException e) {
|
| 937 |
e.printStackTrace();
|
946 |
e.printStackTrace();
|
| 938 |
}
|
- |
|
| 939 |
}
|
947 |
}
|
| - |
|
948 |
}
|
| 940 |
/* List<File> files = new ArrayList<File>();
|
949 |
/* List<File> files = new ArrayList<File>();
|
| 941 |
files.add(new File(SNAPDEAL_INVENTORY_SHEET));
|
950 |
files.add(new File(SNAPDEAL_INVENTORY_SHEET));
|
| 942 |
try {
|
951 |
try {
|
| 943 |
mailer.sendSSLMessage(sendTo,"Inventory File",feedresponse, emailFromAddress, password, files);
|
952 |
mailer.sendSSLMessage(sendTo,"Inventory File",feedresponse, emailFromAddress, password, files);
|
| 944 |
} catch (MessagingException e) {
|
953 |
} catch (MessagingException e) {
|
| 945 |
e.printStackTrace();
|
954 |
e.printStackTrace();
|
| 946 |
}
|
955 |
}
|
| 947 |
*/
|
956 |
*/
|
| 948 |
if(UPDATEUSINGPANEL){
|
957 |
if(UPDATEUSINGPANEL){
|
| 949 |
emailSubjectTxt = "Snapdeal Inventory Updates sent for " +(iterator-1)+" items "+ sdf.format(System.currentTimeMillis() +" "+"(Using Panel)");
|
958 |
emailSubjectTxt = "Snapdeal Inventory Updates sent for " +(iterator-1)+" items "+ sdf.format(System.currentTimeMillis() +" "+"(Using Panel)");
|
| 950 |
}
|
959 |
}
|
| 951 |
else{
|
960 |
else{
|
| 952 |
emailSubjectTxt = "Snapdeal Inventory Updates sent for " +(iterator-1)+" items "+ sdf.format(System.currentTimeMillis());
|
961 |
emailSubjectTxt = "Snapdeal Inventory Updates sent for " +(iterator-1)+" items "+ sdf.format(System.currentTimeMillis());
|
| 953 |
}
|
962 |
}
|
| 954 |
if(inventoryChangeItems.length() > 0){
|
963 |
if(inventoryChangeItems.length() > 0){
|
| 955 |
text = "<html><table border=\"1\" align=\"center\">"+tableHeader+inventoryChangeItems.toString()+"</table></html>";
|
964 |
text = "<html><table border=\"1\" align=\"center\">"+tableHeader+inventoryChangeItems.toString()+"</table></html>";
|
| 956 |
try {
|
965 |
try {
|
| 957 |
mailer.sendSSLMessage(sendTo,emailSubjectTxt, emailFromAddress, password, text);
|
966 |
mailer.sendSSLMessage(sendTo,emailSubjectTxt, emailFromAddress, password, text);
|
| 958 |
} catch (MessagingException e) {
|
967 |
} catch (MessagingException e) {
|
| 959 |
e.printStackTrace();
|
968 |
e.printStackTrace();
|
| 960 |
}
|
- |
|
| 961 |
}
|
969 |
}
|
| - |
|
970 |
}
|
| 962 |
|
971 |
|
| 963 |
tableHeader = "<tr>"
|
972 |
tableHeader = "<tr>"
|
| 964 |
+ "<td>" + "Product Name" +"</td>"
|
973 |
+ "<td>" + "Product Name" +"</td>"
|
| 965 |
+"<td>" + "Item ID" + "</td>"
|
974 |
+"<td>" + "Item ID" + "</td>"
|
| 966 |
+"<td>" + "Available - Reserve" + "</td>"
|
975 |
+"<td>" + "Available - Reserve" + "</td>"
|
| 967 |
+"<td>" + "Total Held" + "</td>"
|
976 |
+"<td>" + "Total Held" + "</td>"
|
| 968 |
+"</tr>";
|
977 |
+"</tr>";
|
| 969 |
|
- |
|
| 970 |
emailSubjectTxt = "Items with (Total Held > Net Available) Inventory "+ sdf.format(System.currentTimeMillis());
|
- |
|
| 971 |
if(heldMoreThanAvailable.length() > 0){
|
- |
|
| 972 |
text = "<html><table border=\"1\" align=\"center\">"+tableHeader+heldMoreThanAvailable.toString()+"</table></html>";
|
- |
|
| 973 |
try {
|
- |
|
| 974 |
mailer.sendSSLMessage(sendTo,emailSubjectTxt, emailFromAddress, password, text);
|
- |
|
| 975 |
//mailer.sendSSLMessage(sendTo,"Snapdeal Inventory Updates sent for " +(iterator-1)+" items "+ sdf.format(System.currentTimeMillis()),inventoryChangeItems.toString(), emailFromAddress, password, new ArrayList<File>());
|
- |
|
| 976 |
} catch (MessagingException e) {
|
- |
|
| 977 |
e.printStackTrace();
|
- |
|
| 978 |
}
|
- |
|
| 979 |
}
|
- |
|
| 980 |
|
978 |
|
| 981 |
}
|
- |
|
| - |
|
979 |
emailSubjectTxt = "Items with (Total Held > Net Available) Inventory "+ sdf.format(System.currentTimeMillis());
|
| 982 |
else{
|
980 |
if(heldMoreThanAvailable.length() > 0){
|
| - |
|
981 |
text = "<html><table border=\"1\" align=\"center\">"+tableHeader+heldMoreThanAvailable.toString()+"</table></html>";
|
| 983 |
try {
|
982 |
try {
|
| - |
|
983 |
mailer.sendSSLMessage(sendTo,emailSubjectTxt, emailFromAddress, password, text);
|
| 984 |
mailer.sendSSLMessage(sendTo,"No changes in Snapdeal inventory to update "+ sdf.format(System.currentTimeMillis()),"No change in Snapdeal Inventory to be updated ", emailFromAddress, password, new ArrayList<File>());
|
984 |
//mailer.sendSSLMessage(sendTo,"Snapdeal Inventory Updates sent for " +(iterator-1)+" items "+ sdf.format(System.currentTimeMillis()),inventoryChangeItems.toString(), emailFromAddress, password, new ArrayList<File>());
|
| 985 |
} catch (MessagingException e) {
|
985 |
} catch (MessagingException e) {
|
| 986 |
e.printStackTrace();
|
986 |
e.printStackTrace();
|
| 987 |
}
|
987 |
}
|
| 988 |
}
|
988 |
}
|
| 989 |
String tableHeader = "<tr>"
|
989 |
tableHeader = "<tr>"
|
| 990 |
+ "<td>" + "Product Name" +"</td>"
|
990 |
+ "<td>" + "Product Name" +"</td>"
|
| 991 |
+"<td>" + "SKU at Snapdeal" + "</td>"
|
991 |
+"<td>" + "SKU at Snapdeal" + "</td>"
|
| 992 |
+"<td>" + "SUPC" + "</td>"
|
992 |
+"<td>" + "SUPC" + "</td>"
|
| 993 |
+"</tr>";
|
993 |
+"</tr>";
|
| 994 |
String text;
|
- |
|
| 995 |
if(notMappedItems.length() >0){
|
994 |
if(notMappedItems.length() >0){
|
| 996 |
text = "<html><table border=\"1\" align=\"center\">"+tableHeader+notMappedItems.toString()+"</table></html>";
|
995 |
text = "<html><table border=\"1\" align=\"center\">"+tableHeader+notMappedItems.toString()+"</table></html>";
|
| 997 |
mailer.sendSSLMessage(sendTo,"Please create Warehouse ID and Item ID mapping", emailFromAddress, password, text);
|
996 |
mailer.sendSSLMessage(sendTo,"Please create Warehouse ID and Item ID mapping", emailFromAddress, password, text);
|
| 998 |
}
|
997 |
}
|
| 999 |
}
|
998 |
}
|