| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- import pymongo
- import pandas
- import json
- import asyncio
- from subdir import db as dbservice
- from sentence_transformers import SentenceTransformer
- model = SentenceTransformer("BAAI/bge-small-zh-v1.5")
- from pymongo import MongoClient
- client = MongoClient()
- client2 = MongoClient()
- db = client["baojia"]
- collection = db["Djcs"]
- 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
- async def main():
-
- for post in collection.find({"biao_id": '68a44e464966105da88382d4'}):##total 006
- ##print(post)
- if not "__children" in post:
- continue
- for entry in (post['__children']):
- ##print(entry['清单编码'])
- cleaned = clean(entry['清单编码'])
-
- if cleaned.startswith("D"):
- continue
- dercj = (entry['dercj'])
- A1, A2, rg, jx, cl, A6, A7, zhuanye = await dbservice.getSingleDeXilie_(model, client2, 10, cleaned, entry['名称'])
-
- if A1 == None:
- if '-F' in cleaned :
- pass
- else:
- print("DE not found")
- print(cleaned)
- print(post)
- else:
- mongo_cl = cl
- mongo_jx = jx
- mongo_rg = 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
- #and item[1] != '01270100'
- #and cleaned !='5-28'
- #and cleaned != '4-3'
- if (not hit) and item[1] != 'S00001' and item[1] != '410000F' and item[1] != 'JD0001' and (not '二类工' in item[2]) and (not '水泥' in item[2]) \
- and (not '砂浆' in item[2]) and item[1] != '99090513' and item[1] != '99090509' and item[1] != '4F0000':
- print(cleaned)
- print("special case found for" + str(item))
-
- print("来自清单")
- print(post['bt'])
- print(post)
- break
- asyncio.run(main())
-
-
-
-
|