Subversion Repositories SmartDukaan

Rev

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

Rev 5520 Rev 6561
Line 22... Line 22...
22
 
22
 
23
to track DOA orders and for other orders ConfigClient is called to get Delhivery_update_url
23
to track DOA orders and for other orders ConfigClient is called to get Delhivery_update_url
24
 
24
 
25
@author: Phani Kumar
25
@author: Phani Kumar
26
'''
26
'''
-
 
27
from shop2020.clients import HelperClient
-
 
28
from shop2020.clients.CRMClient import CRMClient
-
 
29
from shop2020.clients.LogisticsClient import LogisticsClient
-
 
30
from shop2020.clients.TransactionClient import TransactionClient
-
 
31
from shop2020.clients.UserClient import UserClient
-
 
32
from shop2020.config.client.ConfigClient import ConfigClient
-
 
33
from LogisticUtils import enqueueMailForFDA
-
 
34
from shop2020.thriftpy.config.ttypes import ConfigException
-
 
35
from shop2020.thriftpy.crm.ttypes import *
-
 
36
from shop2020.thriftpy.model.v1.order.ttypes import TransactionServiceException, \
-
 
37
    OrderStatus
-
 
38
from shop2020.utils.EmailAttachmentSender import get_attachment_part, mail
-
 
39
from shop2020.utils.Utils import to_py_date
-
 
40
from xml.etree.ElementTree import parse
27
import time
41
import csv
28
import datetime
42
import datetime
29
import optparse
43
import optparse
30
import sys
44
import sys
31
import csv
45
import time
32
import traceback
46
import traceback
33
import urllib2
47
import urllib2
34
from xml.etree.ElementTree import parse
-
 
35
 
48
 
36
if __name__ == '__main__' and __package__ is None:
49
if __name__ == '__main__' and __package__ is None:
37
    import os
50
    import os
38
    sys.path.insert(0, os.getcwd())
51
    sys.path.insert(0, os.getcwd())
39
 
52
 
40
from shop2020.clients.LogisticsClient import LogisticsClient
-
 
41
from shop2020.clients.TransactionClient import TransactionClient
-
 
42
from shop2020.clients.UserClient import UserClient
-
 
43
from shop2020.config.client.ConfigClient import ConfigClient
-
 
44
from shop2020.clients.CRMClient import CRMClient
-
 
45
from shop2020.thriftpy.config.ttypes import ConfigException
-
 
46
from shop2020.thriftpy.model.v1.order.ttypes import TransactionServiceException, OrderStatus
-
 
47
from shop2020.utils.EmailAttachmentSender import get_attachment_part, mail
-
 
48
from shop2020.utils.Utils import to_py_date
-
 
49
from shop2020.thriftpy.crm.ttypes import *
-
 
50
 
53
 
51
try:
54
try:
52
    config_client = ConfigClient()
55
    config_client = ConfigClient()
53
    Delhivery_URL = config_client.get_property("Delhivery_update_url")
56
    Delhivery_URL = config_client.get_property("Delhivery_update_url")
54
except ConfigException as cex:
57
except ConfigException as cex:
Line 619... Line 622...
619
                    activity.customerName = order.customer_name
622
                    activity.customerName = order.customer_name
620
                else:
623
                else:
621
                    ticket.customerId = user.userId
624
                    ticket.customerId = user.userId
622
                    activity.customerId = user.userId
625
                    activity.customerId = user.userId
623
                
626
                
-
 
627
                '''
624
                crmServiceClient.insertTicket(ticket, activity)
628
                crmServiceClient.insertTicket(ticket, activity)
-
 
629
                Inform user about first delivery attempt
-
 
630
                '''
-
 
631
                enqueueMailForFDA(order)
-
 
632
                
625
    except:
633
    except:
626
        print "Some issue while creating crm tickets for orders in FIRST_DELIVERY_ATTEMPT_MADE status"
634
        print "Some issue while creating crm tickets for orders in FIRST_DELIVERY_ATTEMPT_MADE status"
627
        traceback.print_exc()
635
        traceback.print_exc()
628
 
636
 
629
def auto_close_crm_tickets_created():
637
def auto_close_crm_tickets_created():
Line 742... Line 750...
742
        auto_close_crm_tickets_created()
750
        auto_close_crm_tickets_created()
743
    if options.gen_reports:
751
    if options.gen_reports:
744
        generate_reports(provider)
752
        generate_reports(provider)
745
 
753
 
746
if __name__ == '__main__':
754
if __name__ == '__main__':
-
 
755
    providers = LogisticsClient().get_client().getAllProviders()
-
 
756
    for provider in providers:
-
 
757
        if provider.id == 3:
-
 
758
            create_crm_tickets_for_delivey_attempted_orders(provider)
747
    main()
759
        
748
760