Example #1
0
            flag = False
            if t.TypeCode == 6:
                Full_Item.AddQianYue(YeWuYuan,c.FullName)
            #没有联系记录
            elif c.ActivityTime != None:
                #最后一天与当天时间相差天数
                if datetime.datetime.now() >= c.ActivityTime:
                    day = dt.datediff(dt,dt.datetostr(c.ActivityTime),dt.datetostr(datetime.datetime.now()))
                    #相差天数集合
                    listDay = dt.getDays(dt,dt.datetostr(c.ActivityTime),dt.datetostr(datetime.datetime.now()))
                    #判断天数集合中是否存在节假日
                    jDay = 0
                    jMsg = ''
                    if c.OwningBusinessUnit == '030-109b440b-b10c-46ee-bebd-176e443223ed':
                        jMsg = '日本客户'
                        jDay = dt.jieJiaRi(dt,listDay,JD)
                    elif c.OwningBusinessUnit == '030-6354f9c0-2057-455d-bd93-871f3808c3a9':
                        jMsg = '中国客户'
                        jDay = dt.jieJiaRi(dt,listDay,CD)
                    else:
                        jMsg = '客户类型异常'

                    if (day - jDay) > t.Day:
                        Log.Log(('客户ID:').decode('utf8') + str(c.AccountId) + (',姓名:').decode('utf8') + str(c.AccountName) + (',业务员:').decode('utf8') + str(c.FullName) + (',').decode('utf8') + jMsg + (',最后联系时间:').decode('utf8') + str(c.ActivityTime) + (',相差联系天数:').decode('utf8') + str(day) + (',节假日天数:').decode('utf8') + str(jDay) + (',超过安全天数:').decode('utf8') + str(t.Day))
                    else:
                        #Log.Log(('客户ID:').decode('utf8') + str(c.AccountId) + (',姓名:').decode('utf8') + str(c.AccountName) + (',业务员:').decode('utf8') + str(c.FullName) + (',').decode('utf8') + jMsg + (',最后联系时间:').decode('utf8') + str(c.ActivityTime) + (',相差联系天数:').decode('utf8') + str(day) + (',节假日天数:').decode('utf8') + str(jDay) + (',未超过安全天数:').decode('utf8') + str(t.Day))
                        flag = True
                else:
                    flag = True
                    CErrors.append(('最后联系时间大于当前时间:').decode('utf8') + ('客户ID:').decode('utf8') + str(c.AccountId) + (',姓名:').decode('utf8') + str(c.AccountName) + (',业务员:').decode('utf8') + str(c.FullName) + (',').decode('utf8') + jMsg + (',最后联系时间:').decode('utf8') + str(c.ActivityTime) + (',当前时间:').decode('utf8') + str(datetime.datetime.now()))
                #    Log.Log(('最后联系时间大于当前时间:').decode('utf8') + ('客户ID:').decode('utf8') + str(c.AccountId) + (',姓名:').decode('utf8') + str(c.AccountName) + (',业务员:').decode('utf8') + str(c.FullName) + (',').decode('utf8') + jMsg + (',最后联系时间:').decode('utf8') + str(c.ActivityTime) + (',当前时间:').decode('utf8') + str(datetime.datetime.now()))
Example #2
0
# -*- coding: utf-8 -*-
import datetime
import time
from Utility.DateTime_Utility import  DateTime_Utility as dt



print str(dt.datediff(dt,dt.datetostr('2015-05-29 16:27:20.613000'),dt.datetostr(datetime.datetime.now())))
listA = dt.getDays(dt,dt.datetostr('2015-05-29 16:27:20.613000'),dt.datetostr(datetime.datetime.now()))
listB = [(u'2015-05-03',), (u'2015-05-09',), (u'2015-05-10',), (u'2015-05-16',), (u'2015-05-31',), (u'2015-06-06',), (u'2015-06-07',), (u'2015-06-13',), (u'2015-06-14',), (u'2015-06-20',), (u'2015-06-21',), (u'2015-06-27',), (u'2015-06-28',), (u'2015-07-04',), (u'2015-07-05',), (u'2015-07-11',), (u'2015-07-12',), (u'2015-07-18',), (u'2015-07-19',), (u'2015-07-25',), (u'2015-07-26',), (u'2015-08-01',), (u'2015-08-02',), (u'2015-08-08',), (u'2015-08-09',), (u'2015-08-15',), (u'2015-08-16',), (u'2015-08-22',), (u'2015-08-23',), (u'2015-08-29',), (u'2015-08-30',), (u'2015-09-05',), (u'2015-09-06',), (u'2015-09-12',), (u'2015-09-13',), (u'2015-09-19',), (u'2015-09-20',), (u'2015-09-26',), (u'2015-09-27',), (u'2015-10-03',)]

print listA
print dt.jieJiaRi(dt,listA,listB)