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