This commit is contained in:
512song@sina.com committed 2022-10-11 19:38:50 +08:00
commit fc3ae448ca
3 files changed
+2783 -10

No files matched your search

File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+157 -10
View File
@@ -105,17 +105,9 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 236, "execution_count": null,
"id": "a3f0d4b9-78c6-4fd2-baf7-a05962e7904c", "id": "a3f0d4b9-78c6-4fd2-baf7-a05962e7904c",
"metadata": { "metadata": {},
"execution": {
"iopub.execute_input": "2022-09-30T13:02:25.562088Z",
"iopub.status.busy": "2022-09-30T13:02:25.561502Z",
"iopub.status.idle": "2022-09-30T13:02:26.553518Z",
"shell.execute_reply": "2022-09-30T13:02:26.552452Z",
"shell.execute_reply.started": "2022-09-30T13:02:25.562039Z"
}
},
"outputs": [], "outputs": [],
"source": [ "source": [
"import json\n", "import json\n",
@@ -636,6 +628,161 @@
"wb.save(filename) " "wb.save(filename) "
] ]
}, },
{
"cell_type": "markdown",
"id": "b0c3d2bd-85ad-4109-be26-81f0b7b374f0",
"metadata": {},
"source": [
"### 调整人员部门"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5e05ac13-4ed7-4b36-bd76-77283feecfbb",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"\n",
"filename = '../data/安庆石化部门调整.xlsx'\n",
"wb = openpyxl.load_workbook(filename)\n",
"sheet = wb.active\n",
"data1 =list(sheet.values)\n",
"del data1[:2]\n",
"filename = '../data/安庆炼化人员名单2022.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"i = 1\n",
"for item in data1:\n",
" code = str(item[0])\n",
" name = item[1]\n",
" unit = item[4]\n",
" if dict1[code]['name'] == name:\n",
" #print(i,name,unit)\n",
" dict1[code]['unit'] = unit\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict1, fl,ensure_ascii=False) \n",
"print('ok') \n",
" "
]
},
{
"cell_type": "markdown",
"id": "7ec85f17-5dbb-4929-963e-724f0336cc9f",
"metadata": {},
"source": [
"### 删除人员"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "bca57e0d-918b-49d2-ac01-6ad17f0c29a0",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-11T07:42:01.912946Z",
"iopub.status.busy": "2022-10-11T07:42:01.911758Z",
"iopub.status.idle": "2022-10-11T07:42:02.064802Z",
"shell.execute_reply": "2022-10-11T07:42:02.061564Z",
"shell.execute_reply.started": "2022-10-11T07:42:01.912831Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"4129 已删除!\n",
"4165 已删除!\n",
"ok\n"
]
}
],
"source": [
"import json\n",
"\n",
"filename = '../data/安庆炼化人员名单2022.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = [4129,4165]\n",
"for item in list1:\n",
" if str(item) in dict1.keys():\n",
" del dict1[str(item)] \n",
" print(item,'已删除!')\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict1, fl,ensure_ascii=False) \n",
"print('ok') "
]
},
{
"cell_type": "markdown",
"id": "16b2e608-23ea-493d-a8dc-7f0dc1344913",
"metadata": {},
"source": [
"### 体测报告分组"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "14ffd855-4af6-4329-9925-b28d3f0028ef",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import os,sys,shutil\n",
"import json\n",
"import math\n",
"\n",
"fi_xls = '../file/安庆石化2022.xlsx'\n",
"fi_name = {}\n",
"fi_path = '../file/220930'\n",
"old = []\n",
"new = []\n",
"dict1 = {}\n",
"depart = set()\n",
"\n",
"filename = '../data/安庆炼化人员名单2022.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl)\n",
"for k, v in dict2.items():\n",
" depart.add(v['unit']) \n",
" dict1[int(k)] = [v['name'],v['unit']]\n",
" \n",
"# 创建部门办公室 \n",
"\n",
"\n",
"m_path = '../file/220930/new'\n",
"for pn in depart:\n",
" if not os.path.exists(m_path + '/' + pn):\n",
" os.mkdir(m_path + '/' + pn)\n",
"#print(dict1)\n",
"\n",
"\n",
"fl=os.listdir(fi_path)\n",
"for fn in fl:\n",
" if os.path.isfile(fi_path + '/' + fn):\n",
" ofn = int(fn.split('.')[0])\n",
" old.append(ofn)\n",
" #print(fn)\n",
"old.sort()\n",
" #print(str(nfn)+'.pdf')\n",
"\n",
"for n in old:\n",
" \n",
" o_name = f'{fi_path}/{n}.pdf'\n",
" n_name = f'{fi_path}/new/{dict1[n][1]}/{str(n).rjust(5,\"0\")}-{dict1[n][0]}.pdf'\n",
" if not os.path.exists(n_name):\n",
" shutil.copyfile(o_name,n_name)\n",
" print(n_name)"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "f623d291-8d66-4246-a34f-a051115596ef", "id": "f623d291-8d66-4246-a34f-a051115596ef",