daoru trouble
This commit is contained in:
parent
4dd7e88f52
commit
63646dc011
|
@ -197,123 +197,126 @@ def drtodotroubles(companyid,path,userid):
|
||||||
sheetimages = sheet._images #获取图片列表
|
sheetimages = sheet._images #获取图片列表
|
||||||
username = User.objects.get(userid=userid).username
|
username = User.objects.get(userid=userid).username
|
||||||
while sheet['B'+str(i)].value:
|
while sheet['B'+str(i)].value:
|
||||||
jclx = sheet['A'+str(i)].value
|
try:
|
||||||
yhdj = sheet['B'+str(i)].value
|
jclx = sheet['A'+str(i)].value
|
||||||
yhlxo = sheet['C'+str(i)].value
|
yhdj = sheet['B'+str(i)].value
|
||||||
yhlb = sheet['D'+str(i)].value
|
yhlxo = sheet['C'+str(i)].value
|
||||||
yhpg = sheet['E'+str(i)].value
|
yhlb = sheet['D'+str(i)].value
|
||||||
fxsj = sheet['F'+str(i)].value
|
yhpg = sheet['E'+str(i)].value
|
||||||
yhqy = sheet['g'+str(i)].value
|
fxsj = sheet['F'+str(i)].value
|
||||||
yhdd = sheet['h'+str(i)].value
|
yhqy = sheet['g'+str(i)].value
|
||||||
fxbm = sheet['i'+str(i)].value
|
yhdd = sheet['h'+str(i)].value
|
||||||
fxr = sheet['j'+str(i)].value
|
fxbm = sheet['i'+str(i)].value
|
||||||
yhms = sheet['k'+str(i)].value
|
fxr = sheet['j'+str(i)].value
|
||||||
zgbm = sheet['l'+str(i)].value
|
yhms = sheet['k'+str(i)].value
|
||||||
zgr= sheet['m'+str(i)].value
|
zgbm = sheet['l'+str(i)].value
|
||||||
zgqx = sheet['n'+str(i)].value
|
zgr= sheet['m'+str(i)].value
|
||||||
yyfx = sheet['o'+str(i)].value
|
zgqx = sheet['n'+str(i)].value
|
||||||
zgcs = sheet['p'+str(i)].value
|
yyfx = sheet['o'+str(i)].value
|
||||||
fcbm = sheet['q'+str(i)].value
|
zgcs = sheet['p'+str(i)].value
|
||||||
fcr = sheet['r'+str(i)].value
|
fcbm = sheet['q'+str(i)].value
|
||||||
obj = Trouble()
|
fcr = sheet['r'+str(i)].value
|
||||||
if jclx in jclxdict:
|
obj = Trouble()
|
||||||
obj.jclx = jclxdict[jclx]
|
if jclx in jclxdict:
|
||||||
if yhdj in yhdjdict:
|
obj.jclx = jclxdict[jclx]
|
||||||
obj.yhdj = yhdjdict[yhdj]
|
if yhdj in yhdjdict:
|
||||||
if yhlxo in yhlxdicto:
|
obj.yhdj = yhdjdict[yhdj]
|
||||||
obj.yhlxo = yhlxdicto[yhlxo]
|
if yhlxo in yhlxdicto:
|
||||||
for key in yhlbdict:
|
obj.yhlxo = yhlxdicto[yhlxo]
|
||||||
if key in yhlb:
|
for key in yhlbdict:
|
||||||
obj.yhlb = yhlbdict[key]
|
if key in yhlb:
|
||||||
obj.yhlx = obj.yhlb.dicparent
|
obj.yhlb = yhlbdict[key]
|
||||||
if yhpg in yhpgdict:
|
obj.yhlx = obj.yhlb.dicparent
|
||||||
obj.yhpg = yhpgdict[yhpg]
|
if yhpg in yhpgdict:
|
||||||
if fxsj:
|
obj.yhpg = yhpgdict[yhpg]
|
||||||
if isinstance(fxsj,datetime):
|
if fxsj:
|
||||||
obj.fxsj = fxsj
|
if isinstance(fxsj,datetime):
|
||||||
else:
|
obj.fxsj = fxsj
|
||||||
fxsj = fxsj.replace(' ','')
|
else:
|
||||||
if '-' in fxsj:
|
fxsj = fxsj.replace(' ','')
|
||||||
obj.fxsj = datetime.strptime(fxsj,'%Y-%m-%d').date()
|
if '-' in fxsj:
|
||||||
elif '.' in fdate:
|
obj.fxsj = datetime.strptime(fxsj,'%Y-%m-%d').date()
|
||||||
obj.fxsj = datetime.strptime(fxsj,'%Y.%m.%d').date()
|
elif '.' in fdate:
|
||||||
elif '/' in fdate:
|
obj.fxsj = datetime.strptime(fxsj,'%Y.%m.%d').date()
|
||||||
obj.fxsj = datetime.strptime(fxsj,'%Y/%m/%d').date()
|
elif '/' in fdate:
|
||||||
if yhqy in yhqydict:
|
obj.fxsj = datetime.strptime(fxsj,'%Y/%m/%d').date()
|
||||||
obj.yhqy = yhqydict[yhqy]
|
if yhqy in yhqydict:
|
||||||
if yhdd:
|
obj.yhqy = yhqydict[yhqy]
|
||||||
obj.yhdd = yhdd
|
if yhdd:
|
||||||
if fxbm in partdict:
|
obj.yhdd = yhdd
|
||||||
obj.fxbm = partdict[fxbm]
|
if fxbm in partdict:
|
||||||
if fxr:
|
obj.fxbm = partdict[fxbm]
|
||||||
obj.fxr = User.objects.filter(name=fxr,ubelongpart=obj.fxbm)[0]
|
if fxr:
|
||||||
if yhms:
|
obj.fxr = User.objects.filter(name=fxr,ubelongpart=obj.fxbm)[0]
|
||||||
obj.yhms = yhms
|
if yhms:
|
||||||
if zgbm in partdict:
|
obj.yhms = yhms
|
||||||
obj.zgbm = partdict[zgbm]
|
if zgbm in partdict:
|
||||||
if zgr:
|
obj.zgbm = partdict[zgbm]
|
||||||
obj.zgr = User.objects.filter(name=zgr,ubelongpart=obj.zgbm)[0]
|
if zgr:
|
||||||
obj.todouser = obj.zgr
|
obj.zgr = User.objects.filter(name=zgr,ubelongpart=obj.zgbm)[0]
|
||||||
if zgqx:
|
obj.todouser = obj.zgr
|
||||||
if isinstance(zgqx,datetime):
|
if zgqx:
|
||||||
obj.zgqx = zgqx
|
if isinstance(zgqx,datetime):
|
||||||
else:
|
obj.zgqx = zgqx
|
||||||
zgqx = zgqx.replace(' ','')
|
else:
|
||||||
if '-' in zgqx:
|
zgqx = zgqx.replace(' ','')
|
||||||
obj.zgqx = datetime.strptime(zgqx,'%Y-%m-%d').date()
|
if '-' in zgqx:
|
||||||
elif '.' in fdate:
|
obj.zgqx = datetime.strptime(zgqx,'%Y-%m-%d').date()
|
||||||
obj.zgqx = datetime.strptime(zgqx,'%Y.%m.%d').date()
|
elif '.' in fdate:
|
||||||
elif '/' in fdate:
|
obj.zgqx = datetime.strptime(zgqx,'%Y.%m.%d').date()
|
||||||
obj.zgqx = datetime.strptime(zgqx,'%Y/%m/%d').date()
|
elif '/' in fdate:
|
||||||
if yyfx:
|
obj.zgqx = datetime.strptime(zgqx,'%Y/%m/%d').date()
|
||||||
obj.yyfx = yyfx
|
if yyfx:
|
||||||
if zgcs:
|
obj.yyfx = yyfx
|
||||||
obj.zgcs = zgcs
|
if zgcs:
|
||||||
if fcbm in partdict:
|
obj.zgcs = zgcs
|
||||||
user = User.objects.filter(name=fcr,ubelongpart=partdict[fcbm])[0]
|
if fcbm in partdict:
|
||||||
obj.fcr = user
|
user = User.objects.filter(name=fcr,ubelongpart=partdict[fcbm])[0]
|
||||||
for image in sheetimages:
|
obj.fcr = user
|
||||||
if image.anchor._from.row == i-1 and image.anchor._from.col == 18:
|
for image in sheetimages:
|
||||||
imagedata = image._data()#图片二进制数据
|
if image.anchor._from.row == i-1 and image.anchor._from.col == 18:
|
||||||
file_name = datetime.now().strftime('%Y%m%d%H%M%S') + '_yh.jpg'
|
imagedata = image._data()#图片二进制数据
|
||||||
user_upload_folder = os.path.join('media', username)
|
file_name = datetime.now().strftime('%Y%m%d%H%M%S') + '_yh'+str(i)+'.jpg'
|
||||||
if not os.path.exists(user_upload_folder):
|
user_upload_folder = os.path.join('media', username)
|
||||||
os.mkdir(user_upload_folder)
|
if not os.path.exists(user_upload_folder):
|
||||||
filepath = os.path.join(user_upload_folder, file_name)
|
os.mkdir(user_upload_folder)
|
||||||
filepath = filepath.replace('\\', '/')
|
filepath = os.path.join(user_upload_folder, file_name)
|
||||||
with open(filepath,'wb') as f:
|
filepath = filepath.replace('\\', '/')
|
||||||
f.write(imagedata)
|
with open(filepath,'wb') as f:
|
||||||
obj.yhtp = filepath
|
f.write(imagedata)
|
||||||
obj.yhzt = 3 #待整改
|
obj.yhtp = filepath
|
||||||
obj.yhnum = 'YH'+datetime.now().strftime('%Y%m%d%H%M%S')
|
obj.yhzt = 3 #待整改
|
||||||
obj.usecomp = Partment.objects.get(partid=companyid)
|
obj.yhnum = 'YH'+datetime.now().strftime('%Y%m%d%H%M%S')+str(i)
|
||||||
obj.save()
|
obj.usecomp = Partment.objects.get(partid=companyid)
|
||||||
postdict = {
|
obj.save()
|
||||||
'touser': 'oPGqkweX75QtLmgehUN-ipR4hcyc',
|
postdict = {
|
||||||
'template_id': 'lOuwSE67vZC3ZVFYPZvz2eb7JdFxqx7ysMFkXrYmYh0',
|
'touser': 'oPGqkweX75QtLmgehUN-ipR4hcyc',
|
||||||
"miniprogram": {"appid": "wx5c39b569f01c27db"},
|
'template_id': 'lOuwSE67vZC3ZVFYPZvz2eb7JdFxqx7ysMFkXrYmYh0',
|
||||||
'data': {
|
"miniprogram": {"appid": "wx5c39b569f01c27db"},
|
||||||
|
'data': {
|
||||||
|
|
||||||
'first': {
|
'first': {
|
||||||
'value': yhdj + '待整改:'
|
'value': yhdj + '待整改:'
|
||||||
},
|
},
|
||||||
'keyword1': {
|
'keyword1': {
|
||||||
'value': yhms
|
'value': yhms
|
||||||
},
|
},
|
||||||
'keyword2': {
|
'keyword2': {
|
||||||
'value': fxsj
|
'value': fxsj
|
||||||
},
|
},
|
||||||
'keyword3': {
|
'keyword3': {
|
||||||
'value': yhdd
|
'value': yhdd
|
||||||
},
|
},
|
||||||
'remark': {
|
'remark': {
|
||||||
'value': '请您及时完成整改。'
|
'value': '请您及时完成整改。'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
postdict['touser'] = obj.todouser.openid
|
||||||
postdict['touser'] = obj.todouser.openid
|
send_wechatmsg.delay(postdict)
|
||||||
send_wechatmsg.delay(postdict)
|
i = i + 1
|
||||||
i = i + 1
|
except:
|
||||||
|
return '第'+str(i)+'行数据错误,导入终止!'
|
||||||
|
|
||||||
|
|
||||||
def drequipments(companyid,path):
|
def drequipments(companyid,path):
|
||||||
|
|
|
@ -399,7 +399,7 @@ data-options="iconCls:'fa-upload',resizable:true,modal:true,closed:true,border:f
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (data.code == 2) {
|
else if (data.code == 2) {
|
||||||
$.messager.alert('提示', data.msg, 'info', function () {
|
$.messager.alert('警告', data.msg, 'info', function () {
|
||||||
$("#yhtable").datagrid('reload');
|
$("#yhtable").datagrid('reload');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,13 +181,10 @@ urlpatterns = [
|
||||||
path('test',views.test),
|
path('test',views.test),
|
||||||
path('.well-known/pki-validation/fileauth.txt',views.vewechat),#验证
|
path('.well-known/pki-validation/fileauth.txt',views.vewechat),#验证
|
||||||
path('miniprogram/boUR15vyNu.txt',views.minip_px),
|
path('miniprogram/boUR15vyNu.txt',views.minip_px),
|
||||||
<<<<<<< HEAD
|
|
||||||
path('api/getresbilitydata',views.getresbilitydata),#责任制
|
path('api/getresbilitydata',views.getresbilitydata),#责任制
|
||||||
path('api/getprodata',views.getprodata),#操作规程
|
path('api/getprodata',views.getprodata),#操作规程
|
||||||
=======
|
|
||||||
path('boUR15vyNu.txt',views.minip_px),
|
path('boUR15vyNu.txt',views.minip_px),
|
||||||
|
|
||||||
>>>>>>> a4a3b20c8aa023a59b49709971b32d9bc8d9bb43
|
|
||||||
|
|
||||||
#合作模块
|
#合作模块
|
||||||
path('edu/',include('safesite.edu.urls')),
|
path('edu/',include('safesite.edu.urls')),
|
||||||
|
|
BIN
sheetimage.png
BIN
sheetimage.png
Binary file not shown.
Before Width: | Height: | Size: 846 B |
Loading…
Reference in New Issue