| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861 |
- import xml.etree.ElementTree as ET
- from typing import Union
- from fastapi import FastAPI
- import os
- import uuid
- import re
- from fastapi.middleware.cors import CORSMiddleware
- from pydantic import BaseModel
- import pandas as pd
- from numpy import float64
- def getDjcsDingercj(root, bh, bt, qdbm, debm):
- result = [["ID", "人材机编码", "名称", "规格型号", "单位", "单价", "产地",
- "供应厂商", "人材机类别", "甲供标志", "含量", "合价", "暂估价标志", "主要材料标志", "主材标志", "设备标志" ]]
- #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
- item = None
- for child in root:
-
- if child.tag == "Dxgcxx":
- for child1 in child:
- Dwgcbh = child1.attrib["Dwgcbh"]
- if Dwgcbh == bh:
- item = child1
- break
- ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
- Fywj = None
- for child in item:
- if child.tag == 'Csxm':
- Fywj= child
- break
- Rcjhz = None
- for child in item:
- if child.tag == 'Rcjhz':
- Rcjhz = child
- break
- kv = {}
- for entry in Rcjhz:
- kv[entry.attrib["RcjId"]]=entry
- container = None
- for child in Fywj:
- if child.tag == "DjCs":
- container = child
- break
- zimu = None
- for child in container:
- if child.attrib["Bm"] == qdbm:
- zimu = child
- break
- box = None
- if not zimu:
- return result
- for child in zimu:
- if child.tag == "Csxdezj":
- box = child
- break
- hlmx_parent = None
- for child in box:
- if child.attrib["Debm"] == debm:
- for grandchild in child:
- if grandchild.tag == "Csxdercjhl":
- hlmx_parent = grandchild
- for child in hlmx_parent:
- result.append([child.attrib["RcjId"],
- kv[child.attrib["RcjId"]].attrib["RcjBm"],
- kv[child.attrib["RcjId"]].attrib["Mc"],
- kv[child.attrib["RcjId"]].attrib["Ggxh"],
- kv[child.attrib["RcjId"]].attrib["Dw"],
- kv[child.attrib["RcjId"]].attrib["Dj"],
- kv[child.attrib["RcjId"]].attrib["Cd"],
- kv[child.attrib["RcjId"]].attrib["Gycs"],
- kv[child.attrib["RcjId"]].attrib["Rcjlb"],
- kv[child.attrib["RcjId"]].attrib["Jgbz"],
- child.attrib["Rcjhl"], child.attrib["Rcjhj"], "",
- "", "", ""
- ])
- return result
- def getDingercj(root, bh, bt, qdbm, debm):
- result = [["ID", "人材机编码", "名称", "规格型号", "单位", "单价", "产地",
- "供应厂商", "人材机类别", "甲供标志", "含量", "合价", "暂估价标志", "主要材料标志", "主材标志", "设备标志" ]]
- #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
- item = None
- for child in root:
-
- if child.tag == "Dxgcxx":
- for child1 in child:
- Dwgcbh = child1.attrib["Dwgcbh"]
- if Dwgcbh == bh:
- item = child1
- break
- ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
- Fywj = None
- for child in item:
- if child.tag == 'Qdxm':
- Fywj= child
- break
- Rcjhz = None
- for child in item:
- if child.tag == 'Rcjhz':
- Rcjhz = child
- break
- kv = {}
- for entry in Rcjhz:
- kv[entry.attrib["RcjId"]]=entry
- container = None
- for child in Fywj:
- ##child is mx
- if child.tag == "QdBt":
- if child.attrib["Mc"] == bt:
- container = child
- break
- if not container:
- container = Fywj
- zimu = None
- for child in container:
- if child.attrib["Qdbm"] == qdbm:
- zimu = child
- break
- box = None
- if not zimu:
- return result
- for child in zimu:
- if child.tag == "Qdxdezj":
- box = child
- break
- hlmx_parent = None
- for child in box:
- if child.attrib["Debm"] == debm:
- for grandchild in child:
- if grandchild.tag == "Qdxdercjhl":
- hlmx_parent = grandchild
- for child in hlmx_parent:
- result.append([child.attrib["RcjId"],
- kv[child.attrib["RcjId"]].attrib["RcjBm"],
- kv[child.attrib["RcjId"]].attrib["Mc"],
- kv[child.attrib["RcjId"]].attrib["Ggxh"],
- kv[child.attrib["RcjId"]].attrib["Dw"],
- kv[child.attrib["RcjId"]].attrib["Dj"],
- kv[child.attrib["RcjId"]].attrib["Cd"],
- kv[child.attrib["RcjId"]].attrib["Gycs"],
- kv[child.attrib["RcjId"]].attrib["Rcjlb"],
- kv[child.attrib["RcjId"]].attrib["Jgbz"],
- child.attrib["Rcjhl"], child.attrib["Rcjhj"], "",
- "", "", ""
- ])
- return result
- def getDjcsQingdanrcj(root, bh, bt, bm):
- result = [["ID", "人材机编码", "名称", "规格型号", "单位", "单价", "产地",
- "供应厂商", "人材机类别", "甲供标志", "含量", "合价", "暂估价标志", "主要材料标志", "主材标志", "设备标志" ]]
- #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
- item = None
- for child in root:
-
- if child.tag == "Dxgcxx":
- for child1 in child:
- Dwgcbh = child1.attrib["Dwgcbh"]
- if Dwgcbh == bh:
- item = child1
- break
- ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
- Fywj = None
- for child in item:
- if child.tag == 'Csxm':
- Fywj= child
- break
- hl_parent = None
- for child in Fywj:
- if child.tag == "DjCs":
- hl_parent = child
- Rcjhz = None
- for child in item:
- if child.tag == 'Rcjhz':
- Rcjhz = child
- break
- kv = {}
- for entry in Rcjhz:
- kv[entry.attrib["RcjId"]]=entry
- zimu = None
- for child in hl_parent:
- if child.attrib["Bm"] == bm:
- zimu = child
- break
- box = None
- if not zimu:
- return result
- for child in zimu:
- if child.tag == "Csxrcjhl":
- box = child
- break
- for child in box:
- result.append([child.attrib["RcjId"],
- kv[child.attrib["RcjId"]].attrib["RcjBm"],
- kv[child.attrib["RcjId"]].attrib["Mc"],
- kv[child.attrib["RcjId"]].attrib["Ggxh"],
- kv[child.attrib["RcjId"]].attrib["Dw"],
- kv[child.attrib["RcjId"]].attrib["Dj"],
- kv[child.attrib["RcjId"]].attrib["Cd"],
- kv[child.attrib["RcjId"]].attrib["Gycs"],
- kv[child.attrib["RcjId"]].attrib["Rcjlb"],
- kv[child.attrib["RcjId"]].attrib["Jgbz"],
- child.attrib["Rcjhl"], child.attrib["Rcjhj"], child.attrib["Zgjbz"],
- child.attrib["Zyclbz"], child.attrib["Zcbz"], child.attrib["Sbbz"]
- ])
- return result
- def getQingdanTuijian(bh, bt, bm):
- result = [["ID", "定额编号", "工程量名称", "工作内容" ]]
- try:
- all = pd.read_csv("QingDanAllInOne.csv")
- bm_ = int(bm) // 1000
- hit = all[all["qdbh"] == str(bm_)]
- for i in range(len(hit)):
- result.append([hit.iloc[i]["index"].item(), hit.iloc[i]["debh"], hit.iloc[i]["gclmc"], hit.iloc[i]["work"]])
- #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
- finally:
- return result
- def getQingdanrcj(root, bh, bt, bm):
- result = [["ID", "人材机编码", "名称", "规格型号", "单位", "单价", "产地",
- "供应厂商", "人材机类别", "甲供标志", "含量", "合价", "暂估价标志", "主要材料标志", "主材标志", "设备标志" ]]
- #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
- item = None
- for child in root:
-
- if child.tag == "Dxgcxx":
- for child1 in child:
- Dwgcbh = child1.attrib["Dwgcbh"]
- if Dwgcbh == bh:
- item = child1
- break
- ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
- Fywj = None
- for child in item:
- if child.tag == 'Qdxm':
- Fywj= child
- break
- Rcjhz = None
- for child in item:
- if child.tag == 'Rcjhz':
- Rcjhz = child
- break
- kv = {}
- for entry in Rcjhz:
- kv[entry.attrib["RcjId"]]=entry
- container = None
- for child in Fywj:
- ##child is mx
- if child.tag == "QdBt":
- if child.attrib["Mc"] == bt:
- container = child
- break
- if not container:
- container = Fywj
- zimu = None
- for child in container:
- if child.attrib["Qdbm"] == bm:
- zimu = child
- break
- box = None
- if not zimu:
- return result
- for child in zimu:
- if child.tag == "Qdxrcjhl":
- box = child
- break
- for child in box:
- result.append([child.attrib["RcjId"],
- kv[child.attrib["RcjId"]].attrib["RcjBm"],
- kv[child.attrib["RcjId"]].attrib["Mc"],
- kv[child.attrib["RcjId"]].attrib["Ggxh"],
- kv[child.attrib["RcjId"]].attrib["Dw"],
- kv[child.attrib["RcjId"]].attrib["Dj"],
- kv[child.attrib["RcjId"]].attrib["Cd"],
- kv[child.attrib["RcjId"]].attrib["Gycs"],
- kv[child.attrib["RcjId"]].attrib["Rcjlb"],
- kv[child.attrib["RcjId"]].attrib["Jgbz"],
- child.attrib["Rcjhl"], child.attrib["Rcjhj"], child.attrib["Zgjbz"],
- child.attrib["Zyclbz"], child.attrib["Zcbz"], child.attrib["Sbbz"]
- ])
- return result
- def getDjcs(root, id):
- result = []
- #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
- item = None
- for child in root:
-
- if child.tag == "Dxgcxx":
- for child1 in child:
- Dwgcbh = child1.attrib["Dwgcbh"]
- if Dwgcbh == id:
- item = child1
- break
- ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
- Fywj = None
- for child in item:
- if child.tag == 'Csxm':
- Fywj= child
- break
- Djcs_parent = None
- for child in Fywj:
- if child.tag == 'DjCs':
- Djcs_parent = child
- break
-
- for child in Djcs_parent:
- ##child is mx {
- result.append({
- "序号": child.attrib["Xh"], "清单编码": child.attrib["Bm"], "名称" : child.attrib["Mc"],
- "项目特征" : child.attrib["Xmtz"],
- "计算规则" : child.attrib["Jsgz"], "单位" : child.attrib["Dw"], "数量" : child.attrib["Sl"],
- "综合单价" : child.attrib["Zhdj"], "合价" : child.attrib["Zhhj"], "人工费" : child.attrib["Rgf"],
- "主材费" : child.attrib["Zcf"],
- "设备费" : child.attrib["Sbf"], "辅材费" : child.attrib["Fcf"], "材料费" : child.attrib["Clf"],
- "机械费" : child.attrib["Jxf"], "管理费" : child.attrib["Glf"], "利润" : child.attrib["Lr"],
- "暂估价" : child.attrib["Zgj"], "综合人工工日" : child.attrib["Zgr"] })
- __children = []
- zj_parent = None
- for grandchild in child:
- if grandchild.tag == "Csxdezj":
- zj_parent = grandchild
-
- if zj_parent:
- for entry in zj_parent:
- __children.append({
- "序号": None, "清单编码": entry.attrib["Debm"], "名称" : entry.attrib["Mc"],
- "项目特征" : None,
- "计算规则" : None, "单位" : entry.attrib["Dw"], "数量" : entry.attrib["DwQdSl"],
- "综合单价" : entry.attrib["Dj"], "合价" : entry.attrib["Hj"], "人工费" : entry.attrib["Rgf"],
- "主材费" : entry.attrib["Zcf"],
- "设备费" : entry.attrib["Sbf"], "辅材费" : entry.attrib["Fcf"], "材料费" : entry.attrib["Clf"],
- "机械费" : entry.attrib["Jxf"], "管理费" : entry.attrib["Glf"], "利润" : entry.attrib["Lr"],
- "暂估价" : None, "综合人工工日" : None })
- if len(__children) > 0:
- result[-1]["__children"] = __children
- return result
- def getQdmx(root, bh, bt):
- result = []
- #result = [["序号", "清单编码", "名称", "项目特征", "计算规则", "单位", "数量", "综合单价", "合价", "人工费", "主材费", "设备费", "辅材费", "材料费", "机械费", "管理费", "利润" , "暂估价", "综合人工工日", "备注" ]]
- #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
- item = None
- for child in root:
-
- if child.tag == "Dxgcxx":
- for child1 in child:
- Dwgcbh = child1.attrib["Dwgcbh"]
- if Dwgcbh == bh:
- item = child1
- break
- ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
- Fywj = None
- for child in item:
- if child.tag == 'Qdxm':
- Fywj= child
- break
- container = None
- for child in Fywj:
- ##child is mx
- print(child.attrib["Mc"])
- print(bt)
- if child.tag == "QdBt":
- if child.attrib["Mc"] == bt:
- count = 0
- for grandchild in child:
- count = count + 1
- if count > 0:
- print("############hit##########")
- container = child
- break
- print("##########container#########")
- print(container)
- if container == None:
- container = Fywj
- print("##########container#########")
- print(container)
- for child in container:
- print("##############child##########")
- print(child)
- #result = [["序号", "清单编码", "名称", "项目特征", "计算规则", "单位", "数量", "综合单价", "合价", "人工费", "主材费",
- # "设备费", "辅材费", "材料费", "机械费", "管理费", "利润" , "暂估价", "综合人工工日", "备注" ]]
- result.append({
- "操作" : "",
- "序号": child.attrib["Xh"], "清单编码" : child.attrib["Qdbm"], "名称" : child.attrib["Mc"],"项目特征" : child.attrib["Xmtz"],
- "计算规则" : child.attrib["Jsgz"],
- "单位" : child.attrib["Dw"],
- "数量": child.attrib["Sl"],
- "综合单价" : child.attrib["Zhdj"],
- "合价" : child.attrib["Zhhj"],
- "人工费": child.attrib["Rgf"],
- "主材费" : child.attrib["Zcf"],
- "设备费": child.attrib["Sbf"],
- "辅材费": child.attrib["Fcf"],
- "材料费" : child.attrib["Clf"],
- "机械费" : child.attrib["Jxf"],
- "管理费": child.attrib["Glf"],
- "利润": child.attrib["Lr"],
- "暂估价" : child.attrib["Zgj"],
- "综合人工工日" : child.attrib["Zgr"],
- "备注" : child.attrib["Bz"]}
- )
- for child_zj in child:
- if child_zj.tag == "Qdxdezj":
- for child_mx in child_zj:
- if child_mx.tag == "QdxdezjMx":
- parent = result[-1]
- if "__children" in parent:
- parent["__children"].append({
- "操作" : "",
- "序号": None, "清单编码" : child_mx.attrib["Debm"], "名称" : child_mx.attrib["Mc"],"项目特征" : None,
- "计算规则" : None,
- "单位" : child_mx.attrib["Dw"],
- "数量": child_mx.attrib["DwQdSl"],
- "综合单价" : child_mx.attrib["Dj"],
- "合价" : child_mx.attrib["Hj"],
- "人工费": child_mx.attrib["Rgf"],
- "主材费" : child_mx.attrib["Zcf"],
- "设备费": child_mx.attrib["Sbf"],
- "辅材费": child_mx.attrib["Fcf"],
- "材料费" : child_mx.attrib["Clf"],
- "机械费" : child_mx.attrib["Jxf"],
- "管理费": child_mx.attrib["Glf"],
- "利润": child_mx.attrib["Lr"],
- "暂估价" : None,
- "综合人工工日" : None,
- "备注" : None}
- )
- else:
- parent["__children"] = [{
- "操作" : "",
- "序号": None, "清单编码" : child_mx.attrib["Debm"], "名称" : child_mx.attrib["Mc"],"项目特征" : None,
- "计算规则" : None,
- "单位" : child_mx.attrib["Dw"],
- "数量": child_mx.attrib["DwQdSl"],
- "综合单价" : child_mx.attrib["Dj"],
- "合价" : child_mx.attrib["Hj"],
- "人工费": child_mx.attrib["Rgf"],
- "主材费" : child_mx.attrib["Zcf"],
- "设备费": child_mx.attrib["Sbf"],
- "辅材费": child_mx.attrib["Fcf"],
- "材料费" : child_mx.attrib["Clf"],
- "机械费" : child_mx.attrib["Jxf"],
- "管理费": child_mx.attrib["Glf"],
- "利润": child_mx.attrib["Lr"],
- "暂估价" : None,
- "综合人工工日" : None,
- "备注" : None}]
- return result
- def getQdxm(root, id):
- result = []
- #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
- item = None
- for child in root:
-
- if child.tag == "Dxgcxx":
- for child1 in child:
- Dwgcbh = child1.attrib["Dwgcbh"]
- if Dwgcbh == id:
- item = child1
- break
- ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
- Fywj = None
- for child in item:
- if child.tag == 'Qdxm':
- Fywj= child
- break
-
- for child in Fywj:
- ##child is mx
- if child.tag == "QdBt":
- count = 0
- for grandchild in child:
- count = count + 1
- if count > 0:
- result.append(child.attrib["Mc"])
- if len(result) == 0:
- result.append("Default")
- return result
- def getZjcs(root, id):
- result = []
- #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
- item = None
- for child in root:
-
- if child.tag == "Dxgcxx":
- for child1 in child:
- Dwgcbh = child1.attrib["Dwgcbh"]
- if Dwgcbh == id:
- item = child1
- break
- ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
- Fywj = None
- for child in item:
- if child.tag == 'Csxm':
- Fywj= child
- break
- Zjcs_parent = None
- for child in Fywj:
- if child.tag == 'ZjCs':
- Zjcs_parent = child
- break
-
- for child in Zjcs_parent:
- ##child is mx {
- result.append({
- "序号" : child.attrib["Xh"], "清单编码": child.attrib["Bm"], "名称" : child.attrib["Mc"],
- "计算基数" : child.attrib["Js"],
- "计算基础" : child.attrib["Jsjc"], "费率" : child.attrib["Fl"],
- "金额" : child.attrib["Je"], "项目类别" : child.attrib["Xmlb"]})
- __children = []
- for grandchild in child:
- __children.append({
- "序号" : None, "清单编码": None, "名称" : grandchild.attrib["Mc"],
- "计算基数" : grandchild.attrib["Js"],
- "计算基础" : grandchild.attrib["Jsjc"], "费率" : grandchild.attrib["Fl"],
- "金额" : grandchild.attrib["Je"], "项目类别" : grandchild.attrib["Xmlb"]})
- if len(__children) > 0:
- result[-1]["__children"] = __children
- return result
- def getZcbfwf(root, id):
- result = [["序号", "名称", "项目价值", "服务内容", "计算基础", "费率", "金额"]]
- #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
- item = None
- for child in root:
-
- if child.tag == "Dxgcxx":
- for child1 in child:
- Dwgcbh = child1.attrib["Dwgcbh"]
- if Dwgcbh == id:
- item = child1
- break
- ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
- Fywj = None
- for child in item:
- if child.tag == 'Zcbfwf':
- Fywj= child
- break
- for child in Fywj:
- result.append(
- [child.attrib["Xh"],
- child.attrib["Mc"], child.attrib["Xmjz"], child.attrib["Fwnr"], child.attrib["Jsjc"],
- child.attrib["Fl"], child.attrib["Je"]]
- )
- return result
- def getRcjhz(root, id):
- result = [[ "ID", "编码", "名称", "规格型号", "单位", "数量", "单价", "合价", "产地",
- "供应厂商", "人材机类别", "主要材料标志", "主材标志", "设备标志", "甲供标志", "暂估价标志"]]
- for child in root:
-
- if child.tag == "Dxgcxx":
- for child1 in child:
- Dwgcbh = child1.attrib["Dwgcbh"]
- if Dwgcbh == id:
- item = child1
- break
- ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
- Fywj = None
- for child in item:
- if child.tag == 'Rcjhz':
- Fywj= child
- break
- for child in Fywj:
- result.append(
- [
- child.attrib["RcjId"], child.attrib["RcjBm"], child.attrib["Mc"], child.attrib["Ggxh"],
- child.attrib["Dw"], child.attrib["Sl"], child.attrib["Dj"], child.attrib["Hj"],
- child.attrib["Cd"], child.attrib["Gycs"], child.attrib["Rcjlb"],
- child.attrib["Zyclbz"], child.attrib["Zcbz"], child.attrib["Sbbz"], child.attrib["Jgbz"],
- child.attrib["Zgjbz"]]
- )
- return result
- def getFbrgycl(root, id):
- result = [["序号", "ID", "材料编号", "名称", "规格型号", "单位", "数量", "单价", "合价", "交货方式", "送达地点", "备注"]]
- for child in root:
-
- if child.tag == "Dxgcxx":
- for child1 in child:
- Dwgcbh = child1.attrib["Dwgcbh"]
- if Dwgcbh == id:
- item = child1
- break
- ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
- Fywj = None
- for child in item:
- if child.tag == 'Fbrgycl':
- Fywj= child
- break
- for child in Fywj:
- result.append(
- [child.attrib["Xh"],
- child.attrib["RcjId"], child.attrib["Clbh"], child.attrib["Mc"], child.attrib["Ggxh"],
- child.attrib["Dw"], child.attrib["Sl"], child.attrib["Dj"], child.attrib["Hj"], child.attrib["Jhfs"],
- child.attrib["Sddd"], child.attrib["Bz"]]
- )
- return result
- def getJrg(root, id):
- result = [["序号", "名称", "金额", "类别"]]
- #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
- item = None
- for child in root:
-
- if child.tag == "Dxgcxx":
- for child1 in child:
- Dwgcbh = child1.attrib["Dwgcbh"]
- if Dwgcbh == id:
- item = child1
- break
- ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
- Fywj = None
- for child in item:
- if child.tag == 'Jrg':
- Fywj= child
- break
- for child in Fywj:
- result.append(
- [child.attrib["Xh"],
- child.attrib["Mc"], child.attrib["Je"], child.attrib["Lb"]]
- )
- return result
- def getZlje(root, id):
- result = [["序号", "名称", "单位", "暂定金额", "备注"]]
- #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
- item = None
- for child in root:
-
- if child.tag == "Dxgcxx":
- for child1 in child:
- Dwgcbh = child1.attrib["Dwgcbh"]
- if Dwgcbh == id:
- item = child1
- break
- ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
- Fywj = None
- for child in item:
- if child.tag == 'Zlje':
- Fywj= child
- break
- for child in Fywj:
- result.append(
- [child.attrib["Xh"],
- child.attrib["Mc"], child.attrib["Dw"], child.attrib["Zdje"], child.attrib["Bz"]]
- )
- return result
- def getZygczgj(root, id):
- result = [["序号", "名称", "工程内容", "金额", "备注"]]
- #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
- item = None
- for child in root:
-
- if child.tag == "Dxgcxx":
- for child1 in child:
- Dwgcbh = child1.attrib["Dwgcbh"]
- if Dwgcbh == id:
- item = child1
- break
- ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
- Fywj = None
- for child in item:
- if child.tag == 'Zygczg':
- Fywj= child
- break
- for child in Fywj:
- result.append(
- [child.attrib["Xh"],
- child.attrib["Mc"], child.attrib["Gcnr"], child.attrib["Je"], child.attrib["Bz"]]
- )
- return result
- def getQtxm(root, id):
- result = []
- #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
- item = None
- for child in root:
-
- if child.tag == "Dxgcxx":
- for child1 in child:
- Dwgcbh = child1.attrib["Dwgcbh"]
- if Dwgcbh == id:
- item = child1
- break
- ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
- Fywj = None
- for child in item:
- if child.tag == 'Qtxm':
- Fywj= child
- break
- for child in Fywj:
- ##child is mx
- xh = child.attrib["Xh"]
- if "." in xh:
- count = 0
- for entry in xh:
- if entry == ".":
- count = count + 1
- if count == 1:
- parent = result[-1]
- if "__children" in parent:
- children = parent["__children"]
- children.append(
- {"序号":xh, "名称": child.attrib["Mc"],
- "金额": child.attrib["Je"], "项目类别" : child.attrib["Xmlb"], "备注" : child.attrib["Bz"]}
- )
- else:
- parent["__children"] = [
- {"序号":xh, "名称": child.attrib["Mc"],
- "金额": child.attrib["Je"], "项目类别" : child.attrib["Xmlb"], "备注" : child.attrib["Bz"]}]
-
- else:
- result.append(
- {"序号":xh, "名称": child.attrib["Mc"],
- "金额": child.attrib["Je"], "项目类别" : child.attrib["Xmlb"], "备注" : child.attrib["Bz"]}
- )
- return result
- def getGfsj(root, id):
- result = []
- #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
- item = None
- for child in root:
-
- if child.tag == "Dxgcxx":
- for child1 in child:
- Dwgcbh = child1.attrib["Dwgcbh"]
- if Dwgcbh == id:
- item = child1
- break
- ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
- Fywj = None
- for child in item:
- if child.tag == 'Gfsj':
- Fywj= child
- break
- for child in Fywj:
- ##child is mx
- xh = child.attrib["Xh"]
- if "." in xh:
- count = 0
- for entry in xh:
- if entry == ".":
- count = count + 1
- if count == 1:
- parent = result[-1]
- if "__children" in parent:
- children = parent["__children"]
- children.append({"序号":xh, "名称": child.attrib["Mc"], "取费基数": child.attrib["Qfjs"], "计算基础": child.attrib["Jsjc"], "费率": child.attrib['Fl'], "金额": child.attrib["Je"], "类别" : child.attrib["Fyxlb"]})
- else:
- parent["__children"] = [{"序号":xh, "名称": child.attrib["Mc"], "取费基数": child.attrib["Qfjs"], "计算基础": child.attrib["Jsjc"], "费率": child.attrib['Fl'], "金额": child.attrib["Je"], "类别" : child.attrib["Fyxlb"]}]
- elif count == 2:
- parent = result[-1]
- if "__children" in parent:
- parent = parent["__children"][-1]
- print(parent)
- if "__children" in parent:
- children = parent["__children"]
- children.append({"序号":xh, "名称": child.attrib["Mc"], "取费基数": child.attrib["Qfjs"], "计算基础": child.attrib["Jsjc"], "费率": child.attrib['Fl'], "金额": child.attrib["Je"], "类别" : child.attrib["Fyxlb"]})
-
- else:
- parent["__children"] = [{"序号":xh, "名称": child.attrib["Mc"], "取费基数": child.attrib["Qfjs"], "计算基础": child.attrib["Jsjc"], "费率": child.attrib['Fl'], "金额": child.attrib["Je"], "类别" : child.attrib["Fyxlb"]}]
-
- else:
- ###["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
- result.append({"序号":xh, "名称": child.attrib["Mc"], "取费基数": child.attrib["Qfjs"], "计算基础": child.attrib["Jsjc"], "费率": child.attrib['Fl'], "金额": child.attrib["Je"], "类别" : child.attrib["Fyxlb"]})
- return result
- def getBjhz(root, id):
- print(root)
- print(id)
- result = []
- #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
- item = None
- for child in root:
-
- if child.tag == "Dxgcxx":
- for child1 in child:
- Dwgcbh = child1.attrib["Dwgcbh"]
- if Dwgcbh == id:
- item = child1
- break
- ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
- print(item)
- Fywj = None
- for child in item:
- if child.tag == 'Fywj':
- Fywj= child
- break
- for child in Fywj:
- ##child is mx
- xh = child.attrib["Xh"]
- if "." in xh:
- count = 0
- for entry in xh:
- if entry == ".":
- count = count + 1
- if count == 1:
- parent = result[-1]
- if "__children" in parent:
- children = parent["__children"]
- children.append({"序号":xh, "名称": child.attrib["Mc"], "金额": child.attrib["Je"], "暂估价" : child.attrib["Zgj"], "类别" : child.attrib["Fyxlb"]})
- else:
- parent["__children"] = [{"序号":xh, "名称": child.attrib["Mc"], "金额": child.attrib["Je"], "暂估价" : child.attrib["Zgj"], "类别" : child.attrib["Fyxlb"]}]
- elif count == 2:
- parent = result[-1]
- if "__children" in parent:
- parent = parent["__children"][-1]
- print(parent)
- if "__children" in parent:
- children = parent["__children"]
- children.append({"序号":xh, "名称": child.attrib["Mc"], "金额": child.attrib["Je"], "暂估价" : child.attrib["Zgj"], "类别" : child.attrib["Fyxlb"]})
-
- else:
- parent["__children"] = [{"序号":xh, "名称": child.attrib["Mc"], "金额": child.attrib["Je"], "暂估价" : child.attrib["Zgj"], "类别" : child.attrib["Fyxlb"]}]
-
- else:
- ###"序号", "名称", "金额", "暂估价", "类别"]
- result.append({"序号":xh, "名称": child.attrib["Mc"], "金额": child.attrib["Je"],
- "暂估价" : child.attrib["Zgj"], "类别" : child.attrib["Fyxlb"]})
- return result
- def processDes(dataframe, from_, end, level):
- result = []
- for i in range(from_, end):
- item = dataframe.iloc[i]
- fbcch = str(item['fbcch'])
- if fbcch == str(level):
- entry = {"id": str(item["ID"]), "label": str(item["zjbt"])}
- next = i + 1
- while next < end and str(dataframe.iloc[next]["fbcch"]) != str(level):
- next = next + 1
- entry["children"] = processDes(dataframe, i + 1, next, level + 1)
- result.append(entry)
- return result
- def processPbs(dataframe, from_, end, level):
- result = []
- for i in range(from_, end):
- item = dataframe.iloc[i]
- fbcch = str(item['fbcch'])
- if fbcch == str(level):
- entry = {"id": str(item["ID"]), "label": str(item["flmc"]), "data": item["pblbh"]}
- next = i + 1
- while next < end and str(dataframe.iloc[next]["fbcch"]) != str(level):
- next = next + 1
- entry["children"] = processPbs(dataframe, i + 1, next, level + 1)
- result.append(entry)
- return result
- def getCankao():
- tree = ET.parse('de/DeData_Fl.xml')
- root = tree.getroot()
- JSFF = None
- CsFl = None
- result = []
- for child in root:
- if child.tag == "JJFF":
- for grandchild in child:
- if grandchild.tag == 'JSFF':
- JSFF = grandchild
- for child in JSFF:
- if child.attrib['Markup'] == '1':
- for grandchild in child:
- if grandchild.tag == 'CsFl':
- CsFl = grandchild
- for child in CsFl:
- result.append({'工程类型': child.attrib['Gclx'], '名称': child.attrib['Mc'], '计算基础': child.attrib['Jsjc'],
- '参考费率': child.attrib['CkFl'], '地区': child.attrib['Dq'], '备注': child.attrib['Bz']})
- return result
- def getDes(value):
- if value == 10:
- shu = pd.read_csv("de/tj/JD_DingEShu.csv")
- elif value == 20:
- shu = pd.read_csv("de/sz/JD_DingEShu.csv")
- elif value == 30:
- shu = pd.read_csv("de/az/JD_DingEShu.csv")
- elif value == 40:
- shu = pd.read_csv("de/yl/JD_DingEShu.csv")
- elif value == 50:
- shu = pd.read_csv("de/xstj/JD_DingEShu.csv")
- else:
- shu = pd.read_csv("de/xsaz/JD_DingEShu.csv")
- length = len(shu)
- return processDes(shu, 1, length, 2)
- def getPbs(value):
- if value == 10:
- shu = pd.read_csv("de/tj/JD_PeiBiFLB.csv")
- else:
- shu = pd.read_csv("de/sz/JD_PeiBiFLB.csv")
- length = len(shu)
- return processPbs(shu, 0, length, 1)
- def getDeXilie(value, id):
- print(type(id))
- if value == 10:
- shu = pd.read_csv("de/tj/JD_DingEShu.csv")
- elif value == 20:
- shu = pd.read_csv("de/sz/JD_DingEShu.csv")
- elif value == 30:
- shu = pd.read_csv("de/az/JD_DingEShu.csv")
- elif value == 40:
- shu = pd.read_csv("de/yl/JD_DingEShu.csv")
- elif value == 50:
- shu = pd.read_csv("de/xstj/JD_DingEShu.csv")
- else:
- shu = pd.read_csv("de/xsaz/JD_DingEShu.csv")
- hit = shu[shu["ID"]==int(id)]
- print(hit)
- if len(hit) == 0:
- return []
- hit0 = hit.iloc[0]
- index = str(hit0['zjh'])
- print("index=" + index)
- if value == 10:
- gj = pd.read_csv("de/tj/JD_DanWeiGJ.csv")
- filtered = gj[gj["YSDELBH"]==int(index)]
- elif value == 20:
- gj = pd.read_csv("de/sz/JD_DanWeiGJ.csv")
- filtered = gj[gj["YSDELBH"]==(index)]
- elif value == 30:
- gj = pd.read_csv("de/az/JD_DanWeiGJ.csv")
- filtered = gj[gj["YSDELBH"]==(index)]
- elif value == 40:
- gj = pd.read_csv("de/yl/JD_DanWeiGJ.csv")
- filtered = gj[gj["YSDELBH"]==int(index)]
- elif value == 50:
- gj = pd.read_csv("de/xstj/JD_DanWeiGJ.csv")
- filtered = gj[gj["YSDELBH"]==int(index)]
- else:
- gj = pd.read_csv("de/xsaz/JD_DanWeiGJ.csv")
- filtered = gj[gj["YSDELBH"]==int(index)]
- return filtered.to_json(force_ascii=False)
- def getQufei(name):
- if name == "0":
- gj = pd.read_csv("de/tj/JD_PeiBi.csv")
- return gj.to_json(force_ascii=False)
- shu = pd.read_csv("de/tj/JD_PeiBiFLB.csv")
- hit = shu[shu["ID"]==int(name)]
- print(hit)
- if len(hit) == 0:
- return []
- hit0 = hit.iloc[0]
- index = str(hit0['pblbh'])
- index_list = index.split(";")
- gj = pd.read_csv("de/tj/JD_PeiBi.csv")
- filtered = gj[gj["PBBH"].str.startswith(tuple(index_list))]
- return filtered.to_json(force_ascii=False)
- def getPbxl(name):
- if name == "0":
- gj = pd.read_csv("de/tj/JD_PeiBi.csv")
- return gj.to_json(force_ascii=False)
- shu = pd.read_csv("de/tj/JD_PeiBiFLB.csv")
- hit = shu[shu["ID"]==int(name)]
- print(hit)
- if len(hit) == 0:
- return []
- hit0 = hit.iloc[0]
- index = str(hit0['pblbh'])
- index_list = index.split(";")
- gj = pd.read_csv("de/tj/JD_PeiBi.csv")
- filtered = gj[gj["PBBH"].str.startswith(tuple(index_list))]
- return filtered.to_json(force_ascii=False)
- def getSingleDeXilie(zhuanye, debh):
- if zhuanye == 10:
- A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_tj(debh)
- if A1:
- return A1, A2, A3, A4, A5, A6, A7, 10
- else:
- A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_sz(debh)
- return A1, A2, A3, A4,A5, A6, A7, 20
- elif zhuanye == 20:##shizheng
- A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_sz(debh)
- if A1:
- return A1, A2, A3, A4, A5, A6, A7, 20
- else:
- A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_tj(debh)
- if A1:
- return A1, A2, A3, A4, A5, A6, A7, 10
- else:
- A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_az(debh)
- return A1, A2, A3, A4, A5, A6, A7, 30
- elif zhuanye == 30:##anzhuang
- A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_az(debh)
- return A1, A2, A3, A4, A5, A6, A7, 30
- elif zhuanye == 40:##yuanlin
- A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_yl(debh)
- return A1, A2, A3, A4, A5, A6, A7, 40
- elif zhuanye == 50: ## xiushan tujian
- A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_xstj(debh)
- if A1:
- return A1, A2, A3, A4, A5, A6, A7, 50
- else:
- A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_tj(debh)
- return A1, A2, A3, A4,A5, A6, A7, 10
- else:
- A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_xsaz(debh)
- if A1:
- return A1, A2, A3, A4, A5, A6, A7, 60
- else:
- A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_az(debh)
- return A1, A2, A3, A4,A5, A6, A7, 30
- def getSingleDeXilie_xsaz(debh):
- id = None
- bz_selected = []
- bz_selected2 = []
- 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]
- gj = pd.read_csv("de/xsaz/JD_DanWeiGJ.csv")
- filtered = gj[gj["DEBH"]==debh]
- print(filtered)
- if len(filtered) > 0:
- index = (filtered.iloc[0]["YSDELBH"])
- shu = pd.read_csv("de/xsaz/JD_DingEShu.csv")
- hit = shu[shu["zjh"]==index]
- if len(hit) > 0:
- id = hit.iloc[0]["ID"]
- beizhu = str(filtered.iloc[0]["BZBH"])
- if 'nan' in beizhu:
- pass
- else:
- beizhus = beizhu.split(";")
- print(beizhus)
- bzfile = pd.read_csv("de/xsaz/JD_BeiZhuZK.csv")
- bzfile2 = pd.read_csv("de/xsaz/JD_BeiZhuFK.csv", dtype=str)
- bz_selected = bzfile[bzfile["BZBH"].isin(beizhus)]
- bz_selected2 = bzfile2[bzfile2["BZBH"].isin(beizhus)]
- else:
- return None, None, None, None, None, None, None
- ####rengong
- rgde = []
- rg = pd.read_csv("de/xsaz/JD_GuJiaRG.csv")
- filtered1 = rg[rg["DEBH"]==debh]
- for i in range(len(filtered1)):
- rgde_ = {}
- gr = filtered1.iloc[i]["RGR"]##gongri
- gf = filtered1.iloc[i]["RGF"]##gongfei
- rcjID = filtered1.iloc[i]["RcjID"]
- detail = pd.read_csv("de/xsaz/JD_CaiLiaoK.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- CLBH = filtered2.iloc[0]["CLBH"]
- CLMC = filtered2.iloc[0]["CLMC"]
- JLDW = filtered2.iloc[0]["JLDW"]
- YSJG = filtered2.iloc[0]["YSJG"]
- rgde_["CLBH"] = CLBH
- rgde_["CLMC"] = CLMC
- rgde_["JLDW"] = JLDW
- rgde_["YSJG"] = YSJG.item()
- rgde_["gr"] = gr.item()
- rgde_["gf"] = gf.item()
- rgde.append(rgde_)
- ##print(rgde)
- ####jixie
- jxde = []
- jx = pd.read_csv("de/xsaz/JD_GuJiaJX.csv")
- filtered1 = jx[jx["DEBH"]==debh]
- for i in range(len(filtered1)):
- jxde_ = {}
- sl = filtered1.iloc[i]["SL"]##shuliang
- hj = filtered1.iloc[i]["HJ"]##hejia
- rcjID = filtered1.iloc[i]["RcjID"]
- detail = pd.read_csv("de/xsaz/JD_JiXieK.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- jxbh = filtered2.iloc[0]["jxbh"]
- jxmc = filtered2.iloc[0]["jxmc"]
- DW = filtered2.iloc[0]["DW"]
- tbdj = filtered2.iloc[0]["tbdj"]
- jxde_["jxbh"] = jxbh
- jxde_["jxmc"] = jxmc
- jxde_["DW"] = DW
- jxde_["tbdj"] = tbdj.item()
- jxde_["sl"] = sl.item()
- jxde_["hj"] = hj.item()
- jxde.append(jxde_)
- ####cailiao
- clde = []
- cl = pd.read_csv("de/xsaz/JD_GuJiaCL.csv")
- filtered1 = cl[cl["DEBH"]==debh]
- for i in range(len(filtered1)):
- clde_ = {}
- SL = filtered1.iloc[i]["SL"]##shuliang
- HJ = filtered1.iloc[i]["HJ"]##hejia
- rcjID = filtered1.iloc[i]["RcjID"]
- detail = pd.read_csv("de/xsaz/JD_CaiLiaoK.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- CLBH = filtered2.iloc[0]["CLBH"]
- CLMC = filtered2.iloc[0]["CLMC"]
- JLDW = filtered2.iloc[0]["JLDW"]
- YSJG = filtered2.iloc[0]["YSJG"]
- clde_["CLBH"] = CLBH
- clde_["CLMC"] = CLMC
- clde_["JLDW"] = JLDW
- clde_["YSJG"] = YSJG.item()
- clde_["SL"] = SL.item()
- clde_["HJ"] = HJ.item()
- clde.append(clde_)
- else:
- detail = pd.read_csv("de/xsaz/JD_PeiBi.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- CLBH = filtered2.iloc[0]["PBBH"]
- CLMC = filtered2.iloc[0]["PBMC"]
- JLDW = filtered2.iloc[0]["DW"]
- YSJG = filtered2.iloc[0]["PBDJ"]
- clde_["CLBH"] = CLBH.item()
- clde_["CLMC"] = CLMC
- clde_["JLDW"] = JLDW
- clde_["YSJG"] = YSJG.item()
- clde_["SL"] = SL.item()
- clde_["HJ"] = HJ.item()
- clde.append(clde_)
- return filtered.to_json(force_ascii=False), id, rgde, jxde, clde, bz_selected.to_json(force_ascii=False) if len(bz_selected) > 0 else None, bz_selected2.to_json(force_ascii=False) if len(bz_selected2) > 0 else None
- def getSingleDeXilie_xstj(debh):
- id = None
- bz_selected = []
- bz_selected2 = []
- 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]
- gj = pd.read_csv("de/xstj/JD_DanWeiGJ.csv")
- filtered = gj[gj["DEBH"]==debh]
- print(filtered)
- if len(filtered) > 0:
- index = (filtered.iloc[0]["YSDELBH"])
- shu = pd.read_csv("de/xstj/JD_DingEShu.csv")
- hit = shu[shu["zjh"]==index]
- if len(hit) > 0:
- id = hit.iloc[0]["ID"]
- beizhu = str(filtered.iloc[0]["BZBH"])
- if 'nan' in beizhu:
- pass
- else:
- beizhus = beizhu.split(";")
- print(beizhus)
- bzfile = pd.read_csv("de/xstj/JD_BeiZhuZK.csv")
- bzfile2 = pd.read_csv("de/xstj/JD_BeiZhuFK.csv", dtype=str)
- bz_selected = bzfile[bzfile["BZBH"].isin(beizhus)]
- bz_selected2 = bzfile2[bzfile2["BZBH"].isin(beizhus)]
- else:
- return None, None, None, None, None, None, None
- ####rengong
- rgde = []
- rg = pd.read_csv("de/xstj/JD_GuJiaRG.csv")
- filtered1 = rg[rg["DEBH"]==debh]
- for i in range(len(filtered1)):
- rgde_ = {}
- gr = filtered1.iloc[i]["RGR"]##gongri
- gf = filtered1.iloc[i]["RGF"]##gongfei
- rcjID = filtered1.iloc[i]["RcjID"]
- detail = pd.read_csv("de/xstj/JD_CaiLiaoK.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- CLBH = filtered2.iloc[0]["CLBH"]
- CLMC = filtered2.iloc[0]["CLMC"]
- JLDW = filtered2.iloc[0]["JLDW"]
- YSJG = filtered2.iloc[0]["YSJG"]
- rgde_["CLBH"] = CLBH
- rgde_["CLMC"] = CLMC
- rgde_["JLDW"] = JLDW
- rgde_["YSJG"] = YSJG.item()
- rgde_["gr"] = gr.item()
- rgde_["gf"] = gf.item()
- rgde.append(rgde_)
- ##print(rgde)
- ####jixie
- jxde = []
- jx = pd.read_csv("de/xstj/JD_GuJiaJX.csv")
- filtered1 = jx[jx["DEBH"]==debh]
- for i in range(len(filtered1)):
- jxde_ = {}
- sl = filtered1.iloc[i]["SL"]##shuliang
- hj = filtered1.iloc[i]["HJ"]##hejia
- rcjID = filtered1.iloc[i]["RcjID"]
- detail = pd.read_csv("de/xstj/JD_JiXieK.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- jxbh = filtered2.iloc[0]["jxbh"]
- jxmc = filtered2.iloc[0]["jxmc"]
- DW = filtered2.iloc[0]["DW"]
- tbdj = filtered2.iloc[0]["tbdj"]
- jxde_["jxbh"] = jxbh
- jxde_["jxmc"] = jxmc
- jxde_["DW"] = DW
- jxde_["tbdj"] = tbdj.item()
- jxde_["sl"] = sl.item()
- jxde_["hj"] = hj.item()
- jxde.append(jxde_)
- ####cailiao
- clde = []
- cl = pd.read_csv("de/xstj/JD_GuJiaCL.csv")
- filtered1 = cl[cl["DEBH"]==debh]
- for i in range(len(filtered1)):
- clde_ = {}
- SL = filtered1.iloc[i]["SL"]##shuliang
- HJ = filtered1.iloc[i]["HJ"]##hejia
- rcjID = filtered1.iloc[i]["RcjID"]
- detail = pd.read_csv("de/xstj/JD_CaiLiaoK.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- CLBH = filtered2.iloc[0]["CLBH"]
- CLMC = filtered2.iloc[0]["CLMC"]
- JLDW = filtered2.iloc[0]["JLDW"]
- YSJG = filtered2.iloc[0]["YSJG"]
- clde_["CLBH"] = CLBH
- clde_["CLMC"] = CLMC
- clde_["JLDW"] = JLDW
- clde_["YSJG"] = YSJG.item()
- clde_["SL"] = SL.item()
- clde_["HJ"] = HJ.item()
- clde.append(clde_)
- else:
- detail = pd.read_csv("de/xstj/JD_PeiBi.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- CLBH = filtered2.iloc[0]["PBBH"]
- CLMC = filtered2.iloc[0]["PBMC"]
- JLDW = filtered2.iloc[0]["DW"]
- YSJG = filtered2.iloc[0]["PBDJ"]
- clde_["CLBH"] = CLBH.item()
- clde_["CLMC"] = CLMC
- clde_["JLDW"] = JLDW
- clde_["YSJG"] = YSJG.item()
- clde_["SL"] = SL.item()
- clde_["HJ"] = HJ.item()
- clde.append(clde_)
- return filtered.to_json(force_ascii=False), id, rgde, jxde, clde, bz_selected.to_json(force_ascii=False) if len(bz_selected) > 0 else None, bz_selected2.to_json(force_ascii=False) if len(bz_selected2) > 0 else None
- def getSingleDeXilie_yl(debh):
- id = None
- bz_selected = []
- bz_selected2 = []
- 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]
- gj = pd.read_csv("de/yl/JD_DanWeiGJ.csv")
- filtered = gj[gj["DEBH"]==debh]
- print(filtered)
- if len(filtered) > 0:
- index = (filtered.iloc[0]["YSDELBH"])
- shu = pd.read_csv("de/yl/JD_DingEShu.csv")
- hit = shu[shu["zjh"]==index]
- if len(hit) > 0:
- id = hit.iloc[0]["ID"]
- beizhu = str(filtered.iloc[0]["BZBH"])
- if 'nan' in beizhu:
- pass
- else:
- beizhus = beizhu.split(";")
- print(beizhus)
- bzfile = pd.read_csv("de/yl/JD_BeiZhuZK.csv")
- bzfile2 = pd.read_csv("de/yl/JD_BeiZhuFK.csv", dtype=str)
- bz_selected = bzfile[bzfile["BZBH"].isin(beizhus)]
- bz_selected2 = bzfile2[bzfile2["BZBH"].isin(beizhus)]
- else:
- return None, None, None, None, None, None, None
- ####rengong
- rgde = []
- rg = pd.read_csv("de/yl/JD_GuJiaRG.csv")
- filtered1 = rg[rg["DEBH"]==debh]
- for i in range(len(filtered1)):
- rgde_ = {}
- gr = filtered1.iloc[i]["RGR"]##gongri
- gf = filtered1.iloc[i]["RGF"]##gongfei
- rcjID = filtered1.iloc[i]["RcjID"]
- detail = pd.read_csv("de/yl/JD_CaiLiaoK.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- CLBH = filtered2.iloc[0]["CLBH"]
- CLMC = filtered2.iloc[0]["CLMC"]
- JLDW = filtered2.iloc[0]["JLDW"]
- YSJG = filtered2.iloc[0]["YSJG"]
- rgde_["CLBH"] = CLBH
- rgde_["CLMC"] = CLMC
- rgde_["JLDW"] = JLDW
- rgde_["YSJG"] = YSJG.item()
- rgde_["gr"] = gr.item()
- rgde_["gf"] = gf.item()
- rgde.append(rgde_)
- ##print(rgde)
- ####jixie
- jxde = []
- jx = pd.read_csv("de/yl/JD_GuJiaJX.csv")
- filtered1 = jx[jx["DEBH"]==debh]
- for i in range(len(filtered1)):
- jxde_ = {}
- sl = filtered1.iloc[i]["SL"]##shuliang
- hj = filtered1.iloc[i]["HJ"]##hejia
- rcjID = filtered1.iloc[i]["RcjID"]
- detail = pd.read_csv("de/yl/JD_JiXieK.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- jxbh = filtered2.iloc[0]["jxbh"]
- jxmc = filtered2.iloc[0]["jxmc"]
- DW = filtered2.iloc[0]["DW"]
- tbdj = filtered2.iloc[0]["tbdj"]
- jxde_["jxbh"] = jxbh
- jxde_["jxmc"] = jxmc
- jxde_["DW"] = DW
- jxde_["tbdj"] = tbdj.item()
- jxde_["sl"] = sl.item()
- jxde_["hj"] = hj.item()
- jxde.append(jxde_)
- ####cailiao
- clde = []
- cl = pd.read_csv("de/yl/JD_GuJiaCL.csv")
- filtered1 = cl[cl["DEBH"]==debh]
- for i in range(len(filtered1)):
- clde_ = {}
- SL = filtered1.iloc[i]["SL"]##shuliang
- HJ = filtered1.iloc[i]["HJ"]##hejia
- rcjID = filtered1.iloc[i]["RcjID"]
- detail = pd.read_csv("de/yl/JD_CaiLiaoK.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- CLBH = filtered2.iloc[0]["CLBH"]
- CLMC = filtered2.iloc[0]["CLMC"]
- JLDW = filtered2.iloc[0]["JLDW"]
- YSJG = filtered2.iloc[0]["YSJG"]
- clde_["CLBH"] = CLBH
- clde_["CLMC"] = CLMC
- clde_["JLDW"] = JLDW
- clde_["YSJG"] = YSJG.item()
- clde_["SL"] = SL.item()
- clde_["HJ"] = HJ.item()
- clde.append(clde_)
- else:
- detail = pd.read_csv("de/yl/JD_PeiBi.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- CLBH = filtered2.iloc[0]["PBBH"]
- CLMC = filtered2.iloc[0]["PBMC"]
- JLDW = filtered2.iloc[0]["DW"]
- YSJG = filtered2.iloc[0]["PBDJ"]
- clde_["CLBH"] = CLBH.item()
- clde_["CLMC"] = CLMC
- clde_["JLDW"] = JLDW
- clde_["YSJG"] = YSJG.item()
- clde_["SL"] = SL.item()
- clde_["HJ"] = HJ.item()
- clde.append(clde_)
- return filtered.to_json(force_ascii=False), id, rgde, jxde, clde, bz_selected.to_json(force_ascii=False) if len(bz_selected) > 0 else None, bz_selected2.to_json(force_ascii=False) if len(bz_selected2) > 0 else None
- def getSingleDeXilie_az(debh):
- id = None
- bz_selected = []
- bz_selected2 = []
- 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]
- gj = pd.read_csv("de/az/JD_DanWeiGJ.csv")
- filtered = gj[gj["DEBH"]==debh]
- print(filtered)
- if len(filtered) > 0:
- index = (filtered.iloc[0]["YSDELBH"])
- shu = pd.read_csv("de/az/JD_DingEShu.csv")
- hit = shu[shu["zjh"]==index]
- if len(hit) > 0:
- id = hit.iloc[0]["ID"]
- beizhu = str(filtered.iloc[0]["BZBH"])
- if 'nan' in beizhu:
- pass
- else:
- beizhus = beizhu.split(";")
- print(beizhus)
- bzfile = pd.read_csv("de/az/JD_BeiZhuZK.csv")
- bzfile2 = pd.read_csv("de/az/JD_BeiZhuFK.csv", dtype=str)
- bz_selected = bzfile[bzfile["BZBH"].isin(beizhus)]
- bz_selected2 = bzfile2[bzfile2["BZBH"].isin(beizhus)]
- else:
- return None, None, None, None, None, None, None
- ####rengong
- rgde = []
- rg = pd.read_csv("de/az/JD_GuJiaRG.csv")
- filtered1 = rg[rg["DEBH"]==debh]
- for i in range(len(filtered1)):
- rgde_ = {}
- gr = filtered1.iloc[i]["RGR"]##gongri
- gf = filtered1.iloc[i]["RGF"]##gongfei
- rcjID = filtered1.iloc[i]["RcjID"]
- detail = pd.read_csv("de/az/JD_CaiLiaoK.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- CLBH = filtered2.iloc[0]["CLBH"]
- CLMC = filtered2.iloc[0]["CLMC"]
- JLDW = filtered2.iloc[0]["JLDW"]
- YSJG = filtered2.iloc[0]["YSJG"]
- rgde_["CLBH"] = CLBH
- rgde_["CLMC"] = CLMC
- rgde_["JLDW"] = JLDW
- rgde_["YSJG"] = YSJG
- rgde_["gr"] = gr
- rgde_["gf"] = gf
- rgde.append(rgde_)
- ##print(rgde)
- ####jixie
- jxde = []
- jx = pd.read_csv("de/az/JD_GuJiaJX.csv")
- filtered1 = jx[jx["DEBH"]==debh]
- for i in range(len(filtered1)):
- jxde_ = {}
- sl = filtered1.iloc[i]["SL"]##shuliang
- hj = filtered1.iloc[i]["HJ"]##hejia
- rcjID = filtered1.iloc[i]["RcjID"]
- detail = pd.read_csv("de/az/JD_JiXieK.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- jxbh = filtered2.iloc[0]["jxbh"]
- jxmc = filtered2.iloc[0]["jxmc"]
- DW = filtered2.iloc[0]["DW"]
- tbdj = filtered2.iloc[0]["tbdj"]
- jxde_["jxbh"] = jxbh
- jxde_["jxmc"] = jxmc
- jxde_["DW"] = DW
- jxde_["tbdj"] = tbdj
- jxde_["sl"] = sl
- jxde_["hj"] = hj
- jxde.append(jxde_)
- ####cailiao
- clde = []
- cl = pd.read_csv("de/az/JD_GuJiaCL.csv")
- filtered1 = cl[cl["DEBH"]==debh]
- for i in range(len(filtered1)):
- clde_ = {}
- SL = filtered1.iloc[i]["SL"]##shuliang
- HJ = filtered1.iloc[i]["HJ"]##hejia
- rcjID = filtered1.iloc[i]["RcjID"]
- detail = pd.read_csv("de/az/JD_CaiLiaoK.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- CLBH = filtered2.iloc[0]["CLBH"]
- CLMC = filtered2.iloc[0]["CLMC"]
- JLDW = filtered2.iloc[0]["JLDW"]
- YSJG = filtered2.iloc[0]["YSJG"]
- clde_["CLBH"] = CLBH
- clde_["CLMC"] = CLMC
- clde_["JLDW"] = JLDW
- clde_["YSJG"] = YSJG
- clde_["SL"] = SL
- clde_["HJ"] = HJ
- clde.append(clde_)
- else:
- detail = pd.read_csv("de/az/JD_PeiBi.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- CLBH = filtered2.iloc[0]["PBBH"]
- CLMC = filtered2.iloc[0]["PBMC"]
- JLDW = filtered2.iloc[0]["DW"]
- YSJG = filtered2.iloc[0]["PBDJ"]
- clde_["CLBH"] = CLBH
- clde_["CLMC"] = CLMC
- clde_["JLDW"] = JLDW
- clde_["YSJG"] = YSJG
- clde_["SL"] = SL
- clde_["HJ"] = HJ
- clde.append(clde_)
- return filtered.to_json(force_ascii=False), id, rgde, jxde, clde, bz_selected.to_json(force_ascii=False) if len(bz_selected) > 0 else None, bz_selected2.to_json(force_ascii=False) if len(bz_selected2) > 0 else None
- def getSingleDeXilie_sz(debh):
- id = None
- bz_selected = []
- bz_selected2 = []
- 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]
- gj = pd.read_csv("de/sz/JD_DanWeiGJ.csv")
- filtered = gj[gj["DEBH"]==debh]
- print(filtered)
- if len(filtered) > 0:
- index = (filtered.iloc[0]["YSDELBH"])
- shu = pd.read_csv("de/sz/JD_DingEShu.csv")
- hit = shu[shu["zjh"]==index]
- if len(hit) > 0:
- id = hit.iloc[0]["ID"]
- beizhu = str(filtered.iloc[0]["BZBH"])
- if 'nan' in beizhu:
- pass
- else:
- beizhus = beizhu.split(";")
- print(beizhus)
- bzfile = pd.read_csv("de/sz/JD_BeiZhuZK.csv")
- bzfile2 = pd.read_csv("de/sz/JD_BeiZhuFK.csv", dtype=str)
- bz_selected = bzfile[bzfile["BZBH"].isin(beizhus)]
- bz_selected2 = bzfile2[bzfile2["BZBH"].isin(beizhus)]
- else:
- return None, None, None, None, None, None, None
- ####rengong
- rgde = []
- rg = pd.read_csv("de/sz/JD_GuJiaRG.csv")
- filtered1 = rg[rg["DEBH"]==debh]
- for i in range(len(filtered1)):
- rgde_ = {}
- gr = filtered1.iloc[i]["RGR"]##gongri
- gf = filtered1.iloc[i]["RGF"]##gongfei
- rcjID = filtered1.iloc[i]["RcjID"]
- detail = pd.read_csv("de/sz/JD_CaiLiaoK.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- CLBH = filtered2.iloc[0]["CLBH"]
- CLMC = filtered2.iloc[0]["CLMC"]
- JLDW = filtered2.iloc[0]["JLDW"]
- YSJG = filtered2.iloc[0]["YSJG"]
- rgde_["CLBH"] = CLBH
- rgde_["CLMC"] = CLMC
- rgde_["JLDW"] = JLDW
- rgde_["YSJG"] = YSJG.item() if type(YSJG) == float64 else YSJG
- rgde_["gr"] = gr.item() if type(gr) == float64 else gr
- rgde_["gf"] = gf.item() if type(gf) == float64 else gf
- rgde.append(rgde_)
- ##print(rgde)
- ####jixie
- jxde = []
- jx = pd.read_csv("de/sz/JD_GuJiaJX.csv")
- filtered1 = jx[jx["DEBH"]==debh]
- for i in range(len(filtered1)):
- jxde_ = {}
- sl = filtered1.iloc[i]["SL"]##shuliang
- hj = filtered1.iloc[i]["HJ"]##hejia
- rcjID = filtered1.iloc[i]["RcjID"]
- detail = pd.read_csv("de/sz/JD_JiXieK.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- jxbh = filtered2.iloc[0]["jxbh"]
- jxmc = filtered2.iloc[0]["jxmc"]
- DW = filtered2.iloc[0]["DW"]
- tbdj = filtered2.iloc[0]["tbdj"]
- jxde_["jxbh"] = jxbh
- jxde_["jxmc"] = jxmc
- jxde_["DW"] = DW
- jxde_["tbdj"] = tbdj.item() if type(tbdj) == float64 else tbdj
- jxde_["sl"] = sl.item() if type(sl) == float64 else sl
- jxde_["hj"] = hj.item() if type(hj) == float64 else hj
- jxde.append(jxde_)
- ####cailiao
- clde = []
- cl = pd.read_csv("de/sz/JD_GuJiaCL.csv")
- filtered1 = cl[cl["DEBH"]==debh]
- for i in range(len(filtered1)):
- clde_ = {}
- SL = filtered1.iloc[i]["SL"]##shuliang
- HJ = filtered1.iloc[i]["HJ"]##hejia
- rcjID = filtered1.iloc[i]["RcjID"]
- detail = pd.read_csv("de/sz/JD_CaiLiaoK.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- CLBH = filtered2.iloc[0]["CLBH"]
- CLMC = filtered2.iloc[0]["CLMC"]
- JLDW = filtered2.iloc[0]["JLDW"]
- YSJG = filtered2.iloc[0]["YSJG"]
- clde_["CLBH"] = CLBH
- clde_["CLMC"] = CLMC
- clde_["JLDW"] = JLDW
- clde_["YSJG"] = YSJG.item() if type(YSJG) == float64 else YSJG
- clde_["SL"] = SL.item() if type(SL) == float64 else SL
- clde_["HJ"] = HJ.item() if type(HJ) == float64 else HJ
- clde.append(clde_)
- else:
- detail = pd.read_csv("de/sz/JD_PeiBi.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- CLBH = filtered2.iloc[0]["PBBH"]
- CLMC = filtered2.iloc[0]["PBMC"]
- JLDW = filtered2.iloc[0]["DW"]
- YSJG = filtered2.iloc[0]["PBDJ"]
- clde_["CLBH"] = CLBH
- clde_["CLMC"] = CLMC
- clde_["JLDW"] = JLDW
- clde_["YSJG"] = YSJG.item() if type(YSJG) == float64 else YSJG
- clde_["SL"] = SL.item() if type(SL) == float64 else SL
- clde_["HJ"] = HJ.item() if type(HJ) == float64 else HJ
- clde.append(clde_)
- return filtered.to_json(force_ascii=False), id, rgde, jxde, clde, bz_selected.to_json(force_ascii=False) if len(bz_selected) > 0 else None, bz_selected2.to_json(force_ascii=False) if len(bz_selected2) > 0 else None
-
-
- def getSingleDeXilie_tj(debh):
- id = None
- bz_selected = []
- bz_selected2 = []
-
- 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]
- gj = pd.read_csv("de/tj/JD_DanWeiGJ.csv")
- filtered = gj[gj["DEBH"]==debh]
- print(filtered)
- if len(filtered) > 0:
- index = int(filtered.iloc[0]["YSDELBH"])
- shu = pd.read_csv("de/tj/JD_DingEShu.csv")
- hit = shu[shu["zjh"]==index]
- if len(hit) > 0:
- id = hit.iloc[0]["ID"]
- beizhu = str(filtered.iloc[0]["BZBH"])
- if 'nan' in beizhu:
- pass
- else:
- beizhus = beizhu.split(";")
- print(beizhus)
- bzfile = pd.read_csv("de/tj/JD_BeiZhuZK.csv")
- bzfile2 = pd.read_csv("de/tj/JD_BeiZhuFK.csv", dtype=str)
- bz_selected = bzfile[bzfile["BZBH"].isin(beizhus)]
- bz_selected2 = bzfile2[bzfile2["BZBH"].isin(beizhus)]
- else:
- return None, None, None, None, None, None, None
- ####rengong
- rgde = []
- rg = pd.read_csv("de/tj/JD_GuJiaRG.csv")
- filtered1 = rg[rg["DEBH"]==debh]
- for i in range(len(filtered1)):
- rgde_ = {}
- gr = filtered1.iloc[i]["RGR"]##gongri
- gf = filtered1.iloc[i]["RGF"]##gongfei
- rcjID = filtered1.iloc[i]["RcjID"]
- detail = pd.read_csv("de/tj/JD_CaiLiaoK.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- CLBH = filtered2.iloc[0]["CLBH"]
- CLMC = filtered2.iloc[0]["CLMC"]
- JLDW = filtered2.iloc[0]["JLDW"]
- YSJG = filtered2.iloc[0]["YSJG"]
- rgde_["CLBH"] = CLBH
- rgde_["CLMC"] = CLMC
- rgde_["JLDW"] = JLDW
- rgde_["YSJG"] = YSJG.item() if type(YSJG) == float64 else YSJG
- rgde_["gr"] = gr.item() if type(gr) == float64 else gr
- rgde_["gf"] = gf.item() if type(gf) == float64 else gf
- rgde.append(rgde_)
- ##print(rgde)
- ####jixie
- jxde = []
- jx = pd.read_csv("de/tj/JD_GuJiaJX.csv")
- filtered1 = jx[jx["DEBH"]==debh]
- for i in range(len(filtered1)):
- jxde_ = {}
- sl = filtered1.iloc[i]["SL"]##shuliang
- hj = filtered1.iloc[i]["HJ"]##hejia
- rcjID = filtered1.iloc[i]["RcjID"]
- detail = pd.read_csv("de/tj/JD_JiXieK.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- jxbh = filtered2.iloc[0]["jxbh"]
- jxmc = filtered2.iloc[0]["jxmc"]
- DW = filtered2.iloc[0]["DW"]
- tbdj = filtered2.iloc[0]["tbdj"]
- jxde_["jxbh"] = jxbh
- jxde_["jxmc"] = jxmc
- jxde_["DW"] = DW
- jxde_["tbdj"] = tbdj.item() if type(tbdj) == float64 else tbdj
- jxde_["sl"] = sl.item() if type(sl) == float64 else sl
- jxde_["hj"] = hj.item() if type(hj) == float64 else hj
- jxde.append(jxde_)
- ####cailiao
- clde = []
- cl = pd.read_csv("de/tj/JD_GuJiaCL.csv")
- filtered1 = cl[cl["DEBH"]==debh]
- for i in range(len(filtered1)):
- clde_ = {}
- SL = filtered1.iloc[i]["SL"]##shuliang
- HJ = filtered1.iloc[i]["HJ"]##hejia
- rcjID = filtered1.iloc[i]["RcjID"]
- detail = pd.read_csv("de/tj/JD_CaiLiaoK.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- CLBH = filtered2.iloc[0]["CLBH"]
- CLMC = filtered2.iloc[0]["CLMC"]
- JLDW = filtered2.iloc[0]["JLDW"]
- YSJG = filtered2.iloc[0]["YSJG"]
- clde_["CLBH"] = CLBH
- clde_["CLMC"] = CLMC
- clde_["JLDW"] = JLDW
- clde_["YSJG"] = YSJG.item() if type(YSJG) == float64 else YSJG
- clde_["SL"] = SL.item() if type(SL) == float64 else SL
- clde_["HJ"] = HJ.item() if type(HJ) == float64 else HJ
- clde.append(clde_)
- else:
- detail = pd.read_csv("de/tj/JD_PeiBi.csv")
- filtered2 = detail[detail["RcjID"]==rcjID]
- if len(filtered2) > 0:
- CLBH = filtered2.iloc[0]["PBBH"]
- CLMC = filtered2.iloc[0]["PBMC"]
- JLDW = filtered2.iloc[0]["DW"]
- YSJG = filtered2.iloc[0]["PBDJ"]
- clde_["CLBH"] = CLBH
- clde_["CLMC"] = CLMC
- clde_["JLDW"] = JLDW
- clde_["YSJG"] = YSJG.item() if type(YSJG) == float64 else YSJG
- clde_["SL"] = SL.item() if type(SL) == float64 else SL
- clde_["HJ"] = HJ.item() if type(HJ) == float64 else HJ
- clde.append(clde_)
- return filtered.to_json(force_ascii=False), id, rgde, jxde, clde, bz_selected.to_json(force_ascii=False) if len(bz_selected) > 0 else None, bz_selected2.to_json(force_ascii=False) if len(bz_selected2) > 0 else None
- def getDwgc(root, id, Zylb):
- result = []
- #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
- item = None
- for child in root:
-
- if child.tag == "Dxgcxx":
- for child1 in child:
- Dwgcbh = child1.attrib["Dwgcbh"]
- if Dwgcbh == id:
- item = child1
- break
- ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
- id = id + "Zylb" + Zylb
- for child in item:
- if child.tag == "Fywj":
- result.append({"id": id + "bao jia hui zong", "label": "报价汇总表"})
- elif child.tag == "Gfsj":
- result.append({"id": id + "gui fei shui jin", "label": "规费税金"})
- elif child.tag == "Qdxm":
- result.append({"id": id + "qing dan xiang mu", "label": "清单项目"})
- elif child.tag == "Csxm":
- result.append({"id": id + "cuo shi xiang mu", "label": "措施项目"})
- elif child.tag == "Qtxm":
- result.append({"id": id +"qi ta xiang mu", "label": "其他项目"})
- elif child.tag == "Zlje":
- result.append({"id": id +"zan lie jin e", "label": "暂列金额"})
- elif child.tag == "Clzg":
- result.append({"id": id +"cai liao zan gu jia", "label": "材料暂估价"})
- elif child.tag == "Zygczg":
- result.append({"id": id + "zhuan ye gong cheng zan gu jia", "label": "专业工程暂估价"})
- elif child.tag == "Jrg":
- result.append({"id": id + "ji ri gong", "label": "计日工"})
- elif child.tag == "Zcbfwf":
- result.append({"id": id + "zong cheng bao fu wu fei", "label": "总承包服务费"})
- elif child.tag == "Zjxmjdkzffj":
- result.append({"id": id + "zong jia xiang mu jin du kuan zhi fu fen jie", "label": "总价项目进度款支付分解"})
- elif child.tag == "Fbrgycl":
- result.append({"id": id + "fa bao ren gong ying cai liao", "label": "发包人供应材料"})
- elif child.tag == "Cbrgycl":
- result.append({"id": id + "cheng bao ren gong ying cai liao", "label": "承包人供应材料"})
- elif child.tag == "Rcjhz":
- result.append({"id": id + "ren cai ji hui zong", "label": "人材机汇总"})
- else:
- print(child.tag)
- print("WARNING####################################################################")
- return result
|