This commit is contained in:
512song committed 2022-04-27 16:34:40 +08:00
1 parent 4b632ea887
commit a0f03188e3
2 files changed
+472 -2134

No files matched your search

+85 -40
View File
@@ -125,7 +125,10 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "a6147f12-5dd6-46a1-9b66-0d02d2d59197", "id": "a6147f12-5dd6-46a1-9b66-0d02d2d59197",
"metadata": {}, "metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [ "source": [
"### 北海炼化信息导入" "### 北海炼化信息导入"
] ]
@@ -173,7 +176,10 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "15024574-745e-400c-8aac-6f1b6f635362", "id": "15024574-745e-400c-8aac-6f1b6f635362",
"metadata": {}, "metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [ "source": [
"### 济南炼化信息导入" "### 济南炼化信息导入"
] ]
@@ -221,7 +227,10 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "80c42a26-cdc2-4078-93e7-6b8557f41ba2", "id": "80c42a26-cdc2-4078-93e7-6b8557f41ba2",
"metadata": {}, "metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [ "source": [
"### 中石化石油工程设计信息导入" "### 中石化石油工程设计信息导入"
] ]
@@ -269,33 +278,20 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "c0ec85f6-e897-4f94-af46-1007d58ad1e3", "id": "c0ec85f6-e897-4f94-af46-1007d58ad1e3",
"metadata": {}, "metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [ "source": [
"### 沧州炼化信息导入" "### 沧州炼化信息导入"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": null,
"id": "a083426f-9946-47ec-8b2a-ea0a7f287def", "id": "a083426f-9946-47ec-8b2a-ea0a7f287def",
"metadata": { "metadata": {},
"execution": { "outputs": [],
"iopub.execute_input": "2022-03-02T01:42:37.728967Z",
"iopub.status.busy": "2022-03-02T01:42:37.727574Z",
"iopub.status.idle": "2022-03-02T01:42:43.639433Z",
"shell.execute_reply": "2022-03-02T01:42:43.635863Z",
"shell.execute_reply.started": "2022-03-02T01:42:37.728712Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok!\n"
]
}
],
"source": [ "source": [
"import openpyxl\n", "import openpyxl\n",
"import json\n", "import json\n",
@@ -340,27 +336,12 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": null,
"id": "a89e8c88-2b22-4efd-a82e-e7f7bd0d28bd", "id": "a89e8c88-2b22-4efd-a82e-e7f7bd0d28bd",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2022-04-24T10:38:29.567463Z",
"iopub.status.busy": "2022-04-24T10:38:29.566178Z",
"iopub.status.idle": "2022-04-24T10:38:31.198353Z",
"shell.execute_reply": "2022-04-24T10:38:31.195410Z",
"shell.execute_reply.started": "2022-04-24T10:38:29.567313Z"
},
"tags": [] "tags": []
}, },
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok!\n"
]
}
],
"source": [ "source": [
"import openpyxl\n", "import openpyxl\n",
"import json\n", "import json\n",
@@ -395,6 +376,70 @@
" print('该单位已存在!')" " print('该单位已存在!')"
] ]
}, },
{
"cell_type": "markdown",
"id": "d7665556-0455-4688-9cf0-43737e40c6f3",
"metadata": {},
"source": [
"### 岳阳兴长石化信息导入"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "bae91469-c894-468a-9bdd-b1aae367ea39",
"metadata": {
"execution": {
"iopub.execute_input": "2022-04-27T07:46:25.321260Z",
"iopub.status.busy": "2022-04-27T07:46:25.319843Z",
"iopub.status.idle": "2022-04-27T07:46:30.328749Z",
"shell.execute_reply": "2022-04-27T07:46:30.325499Z",
"shell.execute_reply.started": "2022-04-27T07:46:25.320997Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok!\n"
]
}
],
"source": [
"import openpyxl\n",
"import json\n",
"import pymongo\n",
"\n",
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
"mydb = myclient[\"tice\"]\n",
"mycol = mydb[\"unit\"]\n",
"\n",
"name = '岳阳兴长石化股份有限公司'\n",
"short_name = '兴长石化'\n",
"myquery = {\"name\": name}\n",
"if mycol.find_one(myquery) is None:\n",
" wb = openpyxl.load_workbook('data/岳阳兴长.xlsx')\n",
" sheet = wb.active\n",
" # sheets = wb.sheetnames\n",
" depart = []\n",
" dict1 = {}\n",
" new_code = []\n",
" for n in range(2, sheet.max_row+1):\n",
" m_depart = sheet.cell(n,5).value\n",
" if m_depart not in depart:\n",
" depart.append(sheet.cell(n,5).value)\n",
" # print(sheet.cell(n,5).value)\n",
"\n",
" dict1['name'] = '岳阳兴长石化股份有限公司'\n",
" dict1['short_name'] = '兴长石化'\n",
" dict1['depart'] = depart\n",
" mycol.insert_one(dict1)\n",
" print('ok!')\n",
"else:\n",
" print('该单位已存在!')"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "bf42e8af-a506-4e60-a661-b4281e3fef54", "id": "bf42e8af-a506-4e60-a661-b4281e3fef54",
+387 -2094
View File
File diff suppressed because it is too large. Load diff