py——cd
来源:互联网 发布:淘宝商品标题命名规则 编辑:程序博客网 时间:2024/05/17 01:02
#!/usr/bin/env python
import sys
import datetime
import cx_Oracle
org_type_list=[]
org_list=[]
dict={}
subdict={}
subdict1={}
subdict2={}
subdict3={}
org_id=''
s_id=''
tag='0'
type='1'
last_org=''
time=sys.argv[1]
one_BeginTime=datetime.datetime.strptime(time+' 00:00:00',"%Y-%m-%d %H:%M:%S")
two_BeginTime=one_BeginTime + datetime.timedelta(-1)
three_BeginTime=one_BeginTime + datetime.timedelta(-2)
endTime=datetime.datetime.strptime(time+' 23:59:59',"%Y-%m-%d %H:%M:%S")
come='91a70eb4b12e49e99b08ce9d157cd297'
sign='9891cdfe1aed428b97d318d19a6999bd'
send='a4c2cdaeba6444739fda9d1778e74445'
disp='8d5a8e9d942b482a8a4d94baa36abb47'
str="%Y-%m-%d %H:%M:%S"
i=0
def judge():
i=len(org_list)-1
if i>=0:
last_org=org_list[i]
if dict.has_key(last_org):
subdict=dict.get(last_org)
if subdict.has_key(sign):
if datetime.datetime.strptime(subdict.get(sign),str)>one_BeginTime and datetime.datetime.strptime(subdict.get(sign),str)<endTime:
if subdict.has_key(come):
if datetime.datetime.strptime(subdict.get(come),str)>one_BeginTime and datetime.datetime.strptime(subdict.get(come),str)<endTime:
type='1'
tag='1'
print '\t'.join([org_list[i],time,type,tag])
else:
if i>=1 and dict.has_key(org_list[i-1]):
subdict1=dict.get(org_list[i-1])
if subdict1.has_key(send) and datetime.datetime.strptime(subdict1.get(send),str)>one_BeginTime and datetime.datetime.strptime(subdict1.get(send),str)<endTime:
tag='1'
type='1'
print '\t'.join([org_list[i],time,type,tag])
if datetime.datetime.strptime(subdict.get(sign),str)>two_BeginTime and datetime.datetime.strptime(subdict.get(sign),str)<endTime:
if subdict.has_key(come):
if datetime.datetime.strptime(subdict.get(come),str)>two_BeginTime and datetime.datetime.strptime(subdict.get(come),str)<endTime:
type='2'
tag='1'
print '\t'.join([org_list[i],time,type,tag])
else:
if i>=1 and dict.has_key(org_list[i-1]):
subdict2=dict.get(org_list[i-1])
if subdict2.has_key(send) and datetime.datetime.strptime(subdict2.get(send),str)>two_BeginTime and datetime.datetime.strptime(subdict2.get(send),str)<endTime:#
tag='1'
type='2'
print '\t'.join([org_list[i],time,type,tag])
if datetime.datetime.strptime(subdict.get(sign),str)>three_BeginTime and datetime.datetime.strptime(subdict.get(sign),str)<endTime:
if subdict.has_key(come):
if datetime.datetime.strptime(subdict.get(come),str)>three_BeginTime and datetime.datetime.strptime(subdict.get(come),str)<endTime:
type='3'
tag='1'
print '\t'.join([org_list[i],time,type,tag])
else:
if i>=1 and dict.has_key(org_list[i-1]):
subdict3=dict.get(org_list[i-1])
if subdict3.has_key(send) and datetime.datetime.strptime(subdict3.get(send),str)>three_BeginTime and datetime.datetime.strptime(subdict3.get(send),str)<endTime:
tag='1'
type='3'
print '\t'.join([org_list[i],time,type,tag])
elif not subdict.has_key(sign) and subdict.has_key(come):
if datetime.datetime.strptime(subdict.get(come),str)>one_BeginTime and datetime.datetime.strptime(subdict.get(come),str)<endTime:
tag='0'
type='1'
print '\t'.join([org_list[i],time,type,tag])
if datetime.datetime.strptime(subdict.get(come),str)>two_BeginTime and datetime.datetime.strptime(subdict.get(come),str)<endTime:
tag='0'
type='2'
print '\t'.join([org_list[i],time,type,tag])
if datetime.datetime.strptime(subdict.get(come),str)>three_BeginTime and datetime.datetime.strptime(subdict.get(come),str)<endTime:
tag='0'
type='3'
print '\t'.join([org_list[i],time,type,tag])
if __name__=="__main__":
conn=cx_Oracle.connect('DK_PARTY','BkF6QOYXlZ','192.168.21.196:1521/orcl')
cursor=conn.cursor()
sql='select distinct ORG_ID from DKCORE.ORG_ROLES where LOGISTICS_ROLE_ID=\'2af80778ad7c40a18827f1e40b899c28\''
cursor.execute(sql)
rows = cursor.fetchall()
for row in rows:
org_type_list.append(row[0])
for line in sys.stdin:
sid,orgid,scandate,scantypeid,areaid=line.strip().split('\t')
if orgid in org_type_list:
if orgid !='null' and areaid != 'null':
if len(org_list)==0:
org_id=orgid
s_id=sid
org_list.append(orgid)
subdict[scantypeid]=scandate
dict[orgid]=subdict.copy()
elif s_id==sid and org_id==orgid:
subdict=dict.get(orgid)
if not subdict.has_key(scantypeid):
subdict[scantypeid]=scandate
dict[orgid]=subdict.copy()
elif s_id==sid and org_id!=orgid:
org_id=orgid
org_list.append(orgid)
subdict.clear()
subdict[scantypeid]=scandate
dict[orgid]=subdict.copy()
elif s_id != sid:
s_id=sid
org_id=orgid
judge()
org_list=[]
dict.clear()
subdict.clear()
org_list.append(orgid)
subdict[scantypeid]=scandate
dict[orgid]=subdict.copy()
if len(org_list)>1:
judge()
import sys
import datetime
import cx_Oracle
org_type_list=[]
org_list=[]
dict={}
subdict={}
subdict1={}
subdict2={}
subdict3={}
org_id=''
s_id=''
tag='0'
type='1'
last_org=''
time=sys.argv[1]
one_BeginTime=datetime.datetime.strptime(time+' 00:00:00',"%Y-%m-%d %H:%M:%S")
two_BeginTime=one_BeginTime + datetime.timedelta(-1)
three_BeginTime=one_BeginTime + datetime.timedelta(-2)
endTime=datetime.datetime.strptime(time+' 23:59:59',"%Y-%m-%d %H:%M:%S")
come='91a70eb4b12e49e99b08ce9d157cd297'
sign='9891cdfe1aed428b97d318d19a6999bd'
send='a4c2cdaeba6444739fda9d1778e74445'
disp='8d5a8e9d942b482a8a4d94baa36abb47'
str="%Y-%m-%d %H:%M:%S"
i=0
def judge():
i=len(org_list)-1
if i>=0:
last_org=org_list[i]
if dict.has_key(last_org):
subdict=dict.get(last_org)
if subdict.has_key(sign):
if datetime.datetime.strptime(subdict.get(sign),str)>one_BeginTime and datetime.datetime.strptime(subdict.get(sign),str)<endTime:
if subdict.has_key(come):
if datetime.datetime.strptime(subdict.get(come),str)>one_BeginTime and datetime.datetime.strptime(subdict.get(come),str)<endTime:
type='1'
tag='1'
print '\t'.join([org_list[i],time,type,tag])
else:
if i>=1 and dict.has_key(org_list[i-1]):
subdict1=dict.get(org_list[i-1])
if subdict1.has_key(send) and datetime.datetime.strptime(subdict1.get(send),str)>one_BeginTime and datetime.datetime.strptime(subdict1.get(send),str)<endTime:
tag='1'
type='1'
print '\t'.join([org_list[i],time,type,tag])
if datetime.datetime.strptime(subdict.get(sign),str)>two_BeginTime and datetime.datetime.strptime(subdict.get(sign),str)<endTime:
if subdict.has_key(come):
if datetime.datetime.strptime(subdict.get(come),str)>two_BeginTime and datetime.datetime.strptime(subdict.get(come),str)<endTime:
type='2'
tag='1'
print '\t'.join([org_list[i],time,type,tag])
else:
if i>=1 and dict.has_key(org_list[i-1]):
subdict2=dict.get(org_list[i-1])
if subdict2.has_key(send) and datetime.datetime.strptime(subdict2.get(send),str)>two_BeginTime and datetime.datetime.strptime(subdict2.get(send),str)<endTime:#
tag='1'
type='2'
print '\t'.join([org_list[i],time,type,tag])
if datetime.datetime.strptime(subdict.get(sign),str)>three_BeginTime and datetime.datetime.strptime(subdict.get(sign),str)<endTime:
if subdict.has_key(come):
if datetime.datetime.strptime(subdict.get(come),str)>three_BeginTime and datetime.datetime.strptime(subdict.get(come),str)<endTime:
type='3'
tag='1'
print '\t'.join([org_list[i],time,type,tag])
else:
if i>=1 and dict.has_key(org_list[i-1]):
subdict3=dict.get(org_list[i-1])
if subdict3.has_key(send) and datetime.datetime.strptime(subdict3.get(send),str)>three_BeginTime and datetime.datetime.strptime(subdict3.get(send),str)<endTime:
tag='1'
type='3'
print '\t'.join([org_list[i],time,type,tag])
elif not subdict.has_key(sign) and subdict.has_key(come):
if datetime.datetime.strptime(subdict.get(come),str)>one_BeginTime and datetime.datetime.strptime(subdict.get(come),str)<endTime:
tag='0'
type='1'
print '\t'.join([org_list[i],time,type,tag])
if datetime.datetime.strptime(subdict.get(come),str)>two_BeginTime and datetime.datetime.strptime(subdict.get(come),str)<endTime:
tag='0'
type='2'
print '\t'.join([org_list[i],time,type,tag])
if datetime.datetime.strptime(subdict.get(come),str)>three_BeginTime and datetime.datetime.strptime(subdict.get(come),str)<endTime:
tag='0'
type='3'
print '\t'.join([org_list[i],time,type,tag])
if __name__=="__main__":
conn=cx_Oracle.connect('DK_PARTY','BkF6QOYXlZ','192.168.21.196:1521/orcl')
cursor=conn.cursor()
sql='select distinct ORG_ID from DKCORE.ORG_ROLES where LOGISTICS_ROLE_ID=\'2af80778ad7c40a18827f1e40b899c28\''
cursor.execute(sql)
rows = cursor.fetchall()
for row in rows:
org_type_list.append(row[0])
for line in sys.stdin:
sid,orgid,scandate,scantypeid,areaid=line.strip().split('\t')
if orgid in org_type_list:
if orgid !='null' and areaid != 'null':
if len(org_list)==0:
org_id=orgid
s_id=sid
org_list.append(orgid)
subdict[scantypeid]=scandate
dict[orgid]=subdict.copy()
elif s_id==sid and org_id==orgid:
subdict=dict.get(orgid)
if not subdict.has_key(scantypeid):
subdict[scantypeid]=scandate
dict[orgid]=subdict.copy()
elif s_id==sid and org_id!=orgid:
org_id=orgid
org_list.append(orgid)
subdict.clear()
subdict[scantypeid]=scandate
dict[orgid]=subdict.copy()
elif s_id != sid:
s_id=sid
org_id=orgid
judge()
org_list=[]
dict.clear()
subdict.clear()
org_list.append(orgid)
subdict[scantypeid]=scandate
dict[orgid]=subdict.copy()
if len(org_list)>1:
judge()
- py——cd
- HNUST—PY ROAD
- HDU3763.CD——二分
- py练习——计蒜客
- Python——SSHClient.py
- start—py(1、函数)
- CD——改变当前目录
- 批处理——%cd%与%~dp0
- CSMA/CD协议——学习笔记
- Linux命令2——cd
- 计算机网络——CSMA/CD协议
- Linux初讲——cd命令
- 每天一个linux指令——cd
- python解析xml——generateDS.py
- Python实战1——address_book.py
- web.py——WSGI学习笔记
- start—py(2、高阶函数)
- Python的基础—__init__.py介绍
- 科技论文中图片的处理方法
- mdadm详细使用手册
- 特征提取代码总结
- ubuntu10.04挂载exfat格式u盘
- windows 下载android 源代码
- py——cd
- 会话状态保持,JSESSIONID,COOKIE,URL重写
- PowerHA IPaT for Alias or Replacement
- 【方法尽量用API的,方便】Colections和Arrays的使用
- Linux 用户 组操作
- jQuery表单验证插件 Validation for Bootstrap
- 动态规划之最大子段和问题
- 配置WAS数据源启动报错问题
- 混合高斯背景建模程序分析