| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- import pymongo
- import pandas
- import json
- from pymongo import MongoClient
- client = MongoClient()
- client2 = MongoClient()
- db = client["baojia"]
- collection = db["qdxm"]
- db2 = client2["dinge"]
- collection2 = db2["de-collection"]
- def clean(debh):
- if "附注" in debh:
- position = debh.find("附注")
- debh = debh[:position]
- if "*" in debh:
- position = debh.find("*")
- debh = debh[:position]
- if debh.endswith("换"):
- debh = debh[:-1]
- if "[" in debh:
- position = debh.find("[")
- debh = debh[:position-1]
- return debh
- for post in collection.find({"biao_id": '6879086d5d280edee4b4aa15', 'Dwgcbh': '007'}):
- for entry in (post['__children']):
- ##print(entry['清单编码'])
- cleaned = clean(entry['清单编码'])
- if cleaned.startswith("D"):
- continue
- dercj = (entry['dercj'])
- post2 = collection2.find_one({'zhuanye': '安装', 'DEBH' : cleaned })
- if post2 == None:
- pass##input(cleaned + " not found ")
- else:
- mongo_cl = post2['mongo_cl']
- mongo_jx = post2['mongo_jx']
- mongo_rg = post2['mongo_rg']
- for item in dercj:
- bm = item[1]
- if bm == '人材机编码':
- continue
- if "商品砼" in item[2]:
- continue
- hit = False
- for rg in mongo_rg:
- if rg['CLBH'] == bm:
- hit = True
- for cl in mongo_cl:
- if cl['CLBH'] == bm:
- hit = True
- for jx in mongo_jx:
- if jx['jxbh'] == bm:
- hit = True
- if not hit:
- print(cleaned)
- print("special case found for" + str(item))
-
- print("来自清单")
- print(post['bt'])
- print(post)
- break
-
-
-
-
|