Subversion Repositories SmartDukaan

Rev

Rev 2825 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2825 Rev 2832
Line 3... Line 3...
3
import in.shop2020.hotspot.dashbaord.shared.actions.PoType;
3
import in.shop2020.hotspot.dashbaord.shared.actions.PoType;
4
import in.shop2020.hotspot.dashbaord.shared.actions.PurchaseOrder;
4
import in.shop2020.hotspot.dashbaord.shared.actions.PurchaseOrder;
5
import in.shop2020.thrift.clients.WarehouseServiceClient;
5
import in.shop2020.thrift.clients.WarehouseServiceClient;
6
import in.shop2020.utils.GmailUtils;
6
import in.shop2020.utils.GmailUtils;
7
import in.shop2020.warehouse.POStatus;
7
import in.shop2020.warehouse.POStatus;
-
 
8
import in.shop2020.warehouse.Supplier;
8
import in.shop2020.warehouse.WarehouseService.Client;
9
import in.shop2020.warehouse.WarehouseService.Client;
9
 
10
 
10
import java.util.ArrayList;
11
import java.util.ArrayList;
11
import java.util.List;
12
import java.util.List;
12
 
13
 
Line 54... Line 55...
54
    public static void sendPurchaseOrder(long purchaseOrderId){
55
    public static void sendPurchaseOrder(long purchaseOrderId){
55
        try {
56
        try {
56
            WarehouseServiceClient warehouseServiceClient = new WarehouseServiceClient();
57
            WarehouseServiceClient warehouseServiceClient = new WarehouseServiceClient();
57
            Client client = warehouseServiceClient.getClient();
58
            Client client = warehouseServiceClient.getClient();
58
            in.shop2020.warehouse.PurchaseOrder purchaseOrder = client.getPurchaseOrder(purchaseOrderId);
59
            in.shop2020.warehouse.PurchaseOrder purchaseOrder = client.getPurchaseOrder(purchaseOrderId);
-
 
60
            Supplier supplier = client.getSupplier(purchaseOrder.getSupplierId());
59
            
61
            
60
            String filename = PoSheetGenerator.generatePdfSheet(purchaseOrder);
62
            String filename = PoSheetGenerator.generatePdfSheet(purchaseOrder, supplier);
61
            String[] sendTo = { "chandranshu.s@shop2020.in" };
63
            String[] sendTo = { supplier.getContactEmail(), supplier.getHeadEmail() };
62
            String emailSubjectTxt = "Purchase Order No. " + purchaseOrder.getPoNumber();
64
            String emailSubjectTxt = "Purchase Order No. " + purchaseOrder.getPoNumber();
63
            String emailMsgTxt = "Dear Sir/Madam\nCould you please fulfill the attached Purchase Order?\nThanks and Regards\nAnand Sinha";
65
            String emailMsgTxt = "Dear Sir/Madam\n\nCould you please fulfill the attached Purchase Order?\n\nThanks and Regards\nAnand Sinha";
64
            String emailFromAddress = "cnc.center@shop2020.in";
66
            String emailFromAddress = "cnc.center@shop2020.in";
65
            String password = "5h0p2o2o";
67
            String password = "5h0p2o2o";
66
            GmailUtils mailer = new GmailUtils();
68
            GmailUtils mailer = new GmailUtils();
67
            mailer.sendSSLMessage(sendTo, emailSubjectTxt, emailMsgTxt, emailFromAddress, password, filename);
69
            mailer.sendSSLMessage(sendTo, emailSubjectTxt, emailMsgTxt, emailFromAddress, password, filename);
68
        } catch (Exception e) {
70
        } catch (Exception e) {