| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772 |
- 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", "定额编号", "工程量名称", "工作内容" ]]
- 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"])
- 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"])
- if child.tag == "QdBt":
- if child.attrib["Mc"] == bt:
- container = child
- break
- if not container:
- container = Fywj
- for child in container:
- 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":
- 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 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["Je"], "类别" : child.attrib["Fyxlb"]})
- else:
- parent["__children"] = [{"序号":xh, "名称": child.attrib["Mc"], "取费基数": child.attrib["Qfjs"], "计算基础": child.attrib["Jsjc"], "金额": 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["Je"], "类别" : child.attrib["Fyxlb"]})
-
- else:
- parent["__children"] = [{"序号":xh, "名称": child.attrib["Mc"], "取费基数": child.attrib["Qfjs"], "计算基础": child.attrib["Jsjc"], "金额": child.attrib["Je"], "类别" : child.attrib["Fyxlb"]}]
-
- else:
- ###["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
- result.append({"序号":xh, "名称": child.attrib["Mc"], "取费基数": child.attrib["Qfjs"], "计算基础": child.attrib["Jsjc"], "金额": 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 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 getPbxl(name):
- 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
- rgde_["gr"] = gr
- rgde_["gf"] = 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
- jxde_["sl"] = sl
- jxde_["hj"] = 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
- clde_["SL"] = SL
- clde_["HJ"] = 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
- 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_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
- clde_["SL"] = SL
- clde_["HJ"] = 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
- 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 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
|