service.py 83 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109
  1. import xml.etree.ElementTree as ET
  2. from typing import Union
  3. from fastapi import FastAPI
  4. import os
  5. import json
  6. import uuid
  7. import re
  8. from fastapi.middleware.cors import CORSMiddleware
  9. from pydantic import BaseModel
  10. import pandas as pd
  11. from numpy import float64
  12. def getDjcsDingercj(root, bh, bt, qdbm, debm):
  13. result = [["ID", "人材机编码", "名称", "规格型号", "单位", "单价", "产地",
  14. "供应厂商", "人材机类别", "甲供标志", "含量", "合价", "暂估价标志", "主要材料标志", "主材标志", "设备标志" ]]
  15. #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
  16. item = None
  17. for child in root:
  18. if child.tag == "Dxgcxx":
  19. for child1 in child:
  20. Dwgcbh = child1.attrib["Dwgcbh"]
  21. if Dwgcbh == bh:
  22. item = child1
  23. break
  24. ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
  25. Fywj = None
  26. for child in item:
  27. if child.tag == 'Csxm':
  28. Fywj= child
  29. break
  30. Rcjhz = None
  31. for child in item:
  32. if child.tag == 'Rcjhz':
  33. Rcjhz = child
  34. break
  35. kv = {}
  36. for entry in Rcjhz:
  37. kv[entry.attrib["RcjId"]]=entry
  38. container = None
  39. for child in Fywj:
  40. if child.tag == "DjCs":
  41. container = child
  42. break
  43. zimu = None
  44. for child in container:
  45. if child.attrib["Bm"] == qdbm:
  46. zimu = child
  47. break
  48. box = None
  49. if not zimu:
  50. return result
  51. for child in zimu:
  52. if child.tag == "Csxdezj":
  53. box = child
  54. break
  55. hlmx_parent = None
  56. for child in box:
  57. if child.attrib["Debm"] == debm:
  58. for grandchild in child:
  59. if grandchild.tag == "Csxdercjhl":
  60. hlmx_parent = grandchild
  61. for child in hlmx_parent:
  62. result.append([child.attrib["RcjId"],
  63. kv[child.attrib["RcjId"]].attrib["RcjBm"],
  64. kv[child.attrib["RcjId"]].attrib["Mc"],
  65. kv[child.attrib["RcjId"]].attrib["Ggxh"],
  66. kv[child.attrib["RcjId"]].attrib["Dw"],
  67. kv[child.attrib["RcjId"]].attrib["Dj"],
  68. kv[child.attrib["RcjId"]].attrib["Cd"],
  69. kv[child.attrib["RcjId"]].attrib["Gycs"],
  70. kv[child.attrib["RcjId"]].attrib["Rcjlb"],
  71. kv[child.attrib["RcjId"]].attrib["Jgbz"],
  72. child.attrib["Rcjhl"], child.attrib["Rcjhj"], "",
  73. "", "", ""
  74. ])
  75. return result
  76. def getDingercj(root, bh, bt, qdbm, debm):
  77. result = [["ID", "人材机编码", "名称", "规格型号", "单位", "单价", "产地",
  78. "供应厂商", "人材机类别", "甲供标志", "含量", "合价", "暂估价标志", "主要材料标志", "主材标志", "设备标志" ]]
  79. #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
  80. item = None
  81. for child in root:
  82. if child.tag == "Dxgcxx":
  83. for child1 in child:
  84. Dwgcbh = child1.attrib["Dwgcbh"]
  85. if Dwgcbh == bh:
  86. item = child1
  87. break
  88. ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
  89. Fywj = None
  90. for child in item:
  91. if child.tag == 'Qdxm':
  92. Fywj= child
  93. break
  94. Rcjhz = None
  95. for child in item:
  96. if child.tag == 'Rcjhz':
  97. Rcjhz = child
  98. break
  99. kv = {}
  100. for entry in Rcjhz:
  101. kv[entry.attrib["RcjId"]]=entry
  102. container = None
  103. for child in Fywj:
  104. ##child is mx
  105. if child.tag == "QdBt":
  106. if child.attrib["Mc"] == bt:
  107. container = child
  108. break
  109. if not container:
  110. container = Fywj
  111. zimu = None
  112. for child in container:
  113. if child.attrib["Qdbm"] == qdbm:
  114. zimu = child
  115. break
  116. box = None
  117. if not zimu:
  118. return result
  119. for child in zimu:
  120. if child.tag == "Qdxdezj":
  121. box = child
  122. break
  123. hlmx_parent = None
  124. for child in box:
  125. if child.attrib["Debm"] == debm:
  126. for grandchild in child:
  127. if grandchild.tag == "Qdxdercjhl":
  128. hlmx_parent = grandchild
  129. for child in hlmx_parent:
  130. result.append([child.attrib["RcjId"],
  131. kv[child.attrib["RcjId"]].attrib["RcjBm"],
  132. kv[child.attrib["RcjId"]].attrib["Mc"],
  133. kv[child.attrib["RcjId"]].attrib["Ggxh"],
  134. kv[child.attrib["RcjId"]].attrib["Dw"],
  135. kv[child.attrib["RcjId"]].attrib["Dj"],
  136. kv[child.attrib["RcjId"]].attrib["Cd"],
  137. kv[child.attrib["RcjId"]].attrib["Gycs"],
  138. kv[child.attrib["RcjId"]].attrib["Rcjlb"],
  139. kv[child.attrib["RcjId"]].attrib["Jgbz"],
  140. child.attrib["Rcjhl"], child.attrib["Rcjhj"], "",
  141. "", "", ""
  142. ])
  143. return result
  144. def getDjcsQingdanrcj(root, bh, bt, bm):
  145. result = [["ID", "人材机编码", "名称", "规格型号", "单位", "单价", "产地",
  146. "供应厂商", "人材机类别", "甲供标志", "含量", "合价", "暂估价标志", "主要材料标志", "主材标志", "设备标志" ]]
  147. #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
  148. item = None
  149. for child in root:
  150. if child.tag == "Dxgcxx":
  151. for child1 in child:
  152. Dwgcbh = child1.attrib["Dwgcbh"]
  153. if Dwgcbh == bh:
  154. item = child1
  155. break
  156. ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
  157. Fywj = None
  158. for child in item:
  159. if child.tag == 'Csxm':
  160. Fywj= child
  161. break
  162. hl_parent = None
  163. for child in Fywj:
  164. if child.tag == "DjCs":
  165. hl_parent = child
  166. Rcjhz = None
  167. for child in item:
  168. if child.tag == 'Rcjhz':
  169. Rcjhz = child
  170. break
  171. kv = {}
  172. for entry in Rcjhz:
  173. kv[entry.attrib["RcjId"]]=entry
  174. zimu = None
  175. for child in hl_parent:
  176. if child.attrib["Bm"] == bm:
  177. zimu = child
  178. break
  179. box = None
  180. if not zimu:
  181. return result
  182. for child in zimu:
  183. if child.tag == "Csxrcjhl":
  184. box = child
  185. break
  186. for child in box:
  187. result.append([child.attrib["RcjId"],
  188. kv[child.attrib["RcjId"]].attrib["RcjBm"],
  189. kv[child.attrib["RcjId"]].attrib["Mc"],
  190. kv[child.attrib["RcjId"]].attrib["Ggxh"],
  191. kv[child.attrib["RcjId"]].attrib["Dw"],
  192. kv[child.attrib["RcjId"]].attrib["Dj"],
  193. kv[child.attrib["RcjId"]].attrib["Cd"],
  194. kv[child.attrib["RcjId"]].attrib["Gycs"],
  195. kv[child.attrib["RcjId"]].attrib["Rcjlb"],
  196. kv[child.attrib["RcjId"]].attrib["Jgbz"],
  197. child.attrib["Rcjhl"], child.attrib["Rcjhj"], child.attrib["Zgjbz"],
  198. child.attrib["Zyclbz"], child.attrib["Zcbz"], child.attrib["Sbbz"]
  199. ])
  200. return result
  201. def getQingdanTuijian(bh, bt, bm):
  202. result = []
  203. try:
  204. all = pd.read_csv("QingDanAllInOne.csv")
  205. bm_ = int(bm) // 1000
  206. hit = all[all["qdbh"] == str(bm_)]
  207. for i in range(len(hit)):
  208. result.append({'ID': hit.iloc[i]["index"].item(), '定额编号': hit.iloc[i]["debh"], '工程量名称': hit.iloc[i]["gclmc"], '工作内容': hit.iloc[i]["work"]})
  209. #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
  210. finally:
  211. return result
  212. def getQingdanrcj(root, bh, bt, bm):
  213. result = [["ID", "人材机编码", "名称", "规格型号", "单位", "单价", "产地",
  214. "供应厂商", "人材机类别", "甲供标志", "含量", "合价", "暂估价标志", "主要材料标志", "主材标志", "设备标志" ]]
  215. #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
  216. item = None
  217. for child in root:
  218. if child.tag == "Dxgcxx":
  219. for child1 in child:
  220. Dwgcbh = child1.attrib["Dwgcbh"]
  221. if Dwgcbh == bh:
  222. item = child1
  223. break
  224. ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
  225. Fywj = None
  226. for child in item:
  227. if child.tag == 'Qdxm':
  228. Fywj= child
  229. break
  230. Rcjhz = None
  231. for child in item:
  232. if child.tag == 'Rcjhz':
  233. Rcjhz = child
  234. break
  235. kv = {}
  236. for entry in Rcjhz:
  237. kv[entry.attrib["RcjId"]]=entry
  238. container = None
  239. for child in Fywj:
  240. ##child is mx
  241. if child.tag == "QdBt":
  242. if child.attrib["Mc"] == bt:
  243. container = child
  244. break
  245. if not container:
  246. container = Fywj
  247. zimu = None
  248. for child in container:
  249. if child.attrib["Qdbm"] == bm:
  250. zimu = child
  251. break
  252. box = None
  253. if not zimu:
  254. return result
  255. for child in zimu:
  256. if child.tag == "Qdxrcjhl":
  257. box = child
  258. break
  259. for child in box:
  260. result.append([child.attrib["RcjId"],
  261. kv[child.attrib["RcjId"]].attrib["RcjBm"],
  262. kv[child.attrib["RcjId"]].attrib["Mc"],
  263. kv[child.attrib["RcjId"]].attrib["Ggxh"],
  264. kv[child.attrib["RcjId"]].attrib["Dw"],
  265. kv[child.attrib["RcjId"]].attrib["Dj"],
  266. kv[child.attrib["RcjId"]].attrib["Cd"],
  267. kv[child.attrib["RcjId"]].attrib["Gycs"],
  268. kv[child.attrib["RcjId"]].attrib["Rcjlb"],
  269. kv[child.attrib["RcjId"]].attrib["Jgbz"],
  270. child.attrib["Rcjhl"], child.attrib["Rcjhj"], child.attrib["Zgjbz"],
  271. child.attrib["Zyclbz"], child.attrib["Zcbz"], child.attrib["Sbbz"]
  272. ])
  273. return result
  274. def getDjcs(root, id):
  275. result = []
  276. #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
  277. item = None
  278. for child in root:
  279. if child.tag == "Dxgcxx":
  280. for child1 in child:
  281. Dwgcbh = child1.attrib["Dwgcbh"]
  282. if Dwgcbh == id:
  283. item = child1
  284. break
  285. ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
  286. Fywj = None
  287. for child in item:
  288. if child.tag == 'Csxm':
  289. Fywj= child
  290. break
  291. Djcs_parent = None
  292. for child in Fywj:
  293. if child.tag == 'DjCs':
  294. Djcs_parent = child
  295. break
  296. for child in Djcs_parent:
  297. ##child is mx {
  298. result.append({
  299. "序号": child.attrib["Xh"], "清单编码": child.attrib["Bm"], "名称" : child.attrib["Mc"],
  300. "项目特征" : child.attrib["Xmtz"],
  301. "计算规则" : child.attrib["Jsgz"], "单位" : child.attrib["Dw"], "数量" : child.attrib["Sl"],
  302. "综合单价" : child.attrib["Zhdj"], "合价" : child.attrib["Zhhj"], "人工费" : child.attrib["Rgf"],
  303. "主材费" : child.attrib["Zcf"],
  304. "设备费" : child.attrib["Sbf"], "辅材费" : child.attrib["Fcf"], "材料费" : child.attrib["Clf"],
  305. "机械费" : child.attrib["Jxf"], "管理费" : child.attrib["Glf"], "利润" : child.attrib["Lr"],
  306. "暂估价" : child.attrib["Zgj"], "综合人工工日" : child.attrib["Zgr"] })
  307. __children = []
  308. zj_parent = None
  309. for grandchild in child:
  310. if grandchild.tag == "Csxdezj":
  311. zj_parent = grandchild
  312. if zj_parent:
  313. for entry in zj_parent:
  314. __children.append({
  315. "序号": None, "清单编码": entry.attrib["Debm"], "名称" : entry.attrib["Mc"],
  316. "项目特征" : None,
  317. "计算规则" : None, "单位" : entry.attrib["Dw"], "数量" : entry.attrib["DwQdSl"],
  318. "综合单价" : entry.attrib["Dj"], "合价" : entry.attrib["Hj"], "人工费" : entry.attrib["Rgf"],
  319. "主材费" : entry.attrib["Zcf"],
  320. "设备费" : entry.attrib["Sbf"], "辅材费" : entry.attrib["Fcf"], "材料费" : entry.attrib["Clf"],
  321. "机械费" : entry.attrib["Jxf"], "管理费" : entry.attrib["Glf"], "利润" : entry.attrib["Lr"],
  322. "暂估价" : None, "综合人工工日" : None })
  323. if len(__children) > 0:
  324. result[-1]["__children"] = __children
  325. return result
  326. def getQdmx(root, bh, bt):
  327. result = []
  328. #result = [["序号", "清单编码", "名称", "项目特征", "计算规则", "单位", "数量", "综合单价", "合价", "人工费", "主材费", "设备费", "辅材费", "材料费", "机械费", "管理费", "利润" , "暂估价", "综合人工工日", "备注" ]]
  329. #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
  330. item = None
  331. for child in root:
  332. if child.tag == "Dxgcxx":
  333. for child1 in child:
  334. Dwgcbh = child1.attrib["Dwgcbh"]
  335. if Dwgcbh == bh:
  336. item = child1
  337. break
  338. ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
  339. Fywj = None
  340. for child in item:
  341. if child.tag == 'Qdxm':
  342. Fywj= child
  343. break
  344. container = None
  345. for child in Fywj:
  346. ##child is mx
  347. if child.tag == "QdBt":
  348. if child.attrib["Mc"] == bt:
  349. count = 0
  350. for grandchild in child:
  351. count = count + 1
  352. if count > 0:
  353. container = child
  354. break
  355. if container == None:
  356. container = Fywj
  357. for child in container:
  358. #result = [["序号", "清单编码", "名称", "项目特征", "计算规则", "单位", "数量", "综合单价", "合价", "人工费", "主材费",
  359. # "设备费", "辅材费", "材料费", "机械费", "管理费", "利润" , "暂估价", "综合人工工日", "备注" ]]
  360. result.append({
  361. "操作" : "",
  362. "序号": child.attrib["Xh"], "清单编码" : child.attrib["Qdbm"], "名称" : child.attrib["Mc"],"项目特征" : child.attrib["Xmtz"],
  363. "计算规则" : child.attrib["Jsgz"],
  364. "单位" : child.attrib["Dw"],
  365. "数量": child.attrib["Sl"],
  366. "综合单价" : child.attrib["Zhdj"],
  367. "合价" : child.attrib["Zhhj"],
  368. "人工费": child.attrib["Rgf"],
  369. "主材费" : child.attrib["Zcf"],
  370. "设备费": child.attrib["Sbf"],
  371. "辅材费": child.attrib["Fcf"],
  372. "材料费" : child.attrib["Clf"],
  373. "机械费" : child.attrib["Jxf"],
  374. "管理费": child.attrib["Glf"],
  375. "利润": child.attrib["Lr"],
  376. "暂估价" : child.attrib["Zgj"],
  377. "综合人工工日" : child.attrib["Zgr"],
  378. "备注" : child.attrib["Bz"]}
  379. )
  380. for child_zj in child:
  381. if child_zj.tag == "Qdxdezj":
  382. for child_mx in child_zj:
  383. if child_mx.tag == "QdxdezjMx":
  384. parent = result[-1]
  385. if "__children" in parent:
  386. parent["__children"].append({
  387. "操作" : "",
  388. "序号": None, "清单编码" : child_mx.attrib["Debm"], "名称" : child_mx.attrib["Mc"],"项目特征" : None,
  389. "计算规则" : None,
  390. "单位" : child_mx.attrib["Dw"],
  391. "数量": child_mx.attrib["DwQdSl"],
  392. "综合单价" : child_mx.attrib["Dj"],
  393. "合价" : child_mx.attrib["Hj"],
  394. "人工费": child_mx.attrib["Rgf"],
  395. "主材费" : child_mx.attrib["Zcf"],
  396. "设备费": child_mx.attrib["Sbf"],
  397. "辅材费": child_mx.attrib["Fcf"],
  398. "材料费" : child_mx.attrib["Clf"],
  399. "机械费" : child_mx.attrib["Jxf"],
  400. "管理费": child_mx.attrib["Glf"],
  401. "利润": child_mx.attrib["Lr"],
  402. "暂估价" : None,
  403. "综合人工工日" : None,
  404. "备注" : None}
  405. )
  406. else:
  407. parent["__children"] = [{
  408. "操作" : "",
  409. "序号": None, "清单编码" : child_mx.attrib["Debm"], "名称" : child_mx.attrib["Mc"],"项目特征" : None,
  410. "计算规则" : None,
  411. "单位" : child_mx.attrib["Dw"],
  412. "数量": child_mx.attrib["DwQdSl"],
  413. "综合单价" : child_mx.attrib["Dj"],
  414. "合价" : child_mx.attrib["Hj"],
  415. "人工费": child_mx.attrib["Rgf"],
  416. "主材费" : child_mx.attrib["Zcf"],
  417. "设备费": child_mx.attrib["Sbf"],
  418. "辅材费": child_mx.attrib["Fcf"],
  419. "材料费" : child_mx.attrib["Clf"],
  420. "机械费" : child_mx.attrib["Jxf"],
  421. "管理费": child_mx.attrib["Glf"],
  422. "利润": child_mx.attrib["Lr"],
  423. "暂估价" : None,
  424. "综合人工工日" : None,
  425. "备注" : None}]
  426. return result
  427. def getQdmx_default(root, bh, bt):
  428. result = []
  429. #result = [["序号", "清单编码", "名称", "项目特征", "计算规则", "单位", "数量", "综合单价", "合价", "人工费", "主材费", "设备费", "辅材费", "材料费", "机械费", "管理费", "利润" , "暂估价", "综合人工工日", "备注" ]]
  430. #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
  431. item = None
  432. for child in root:
  433. if child.tag == "Dxgcxx":
  434. for child1 in child:
  435. Dwgcbh = child1.attrib["Dwgcbh"]
  436. if Dwgcbh == bh:
  437. item = child1
  438. break
  439. ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
  440. Fywj = None
  441. for child in item:
  442. if child.tag == 'Qdxm':
  443. Fywj= child
  444. break
  445. container = None
  446. for child in Fywj:
  447. ##child is mx
  448. if child.tag == "Qdmx":
  449. #result = [["序号", "清单编码", "名称", "项目特征", "计算规则", "单位", "数量", "综合单价", "合价", "人工费", "主材费",
  450. # "设备费", "辅材费", "材料费", "机械费", "管理费", "利润" , "暂估价", "综合人工工日", "备注" ]]
  451. result.append({
  452. "操作" : "",
  453. "序号": child.attrib["Xh"], "清单编码" : child.attrib["Qdbm"], "名称" : child.attrib["Mc"],"项目特征" : child.attrib["Xmtz"],
  454. "计算规则" : child.attrib["Jsgz"],
  455. "单位" : child.attrib["Dw"],
  456. "数量": child.attrib["Sl"],
  457. "综合单价" : child.attrib["Zhdj"],
  458. "合价" : child.attrib["Zhhj"],
  459. "人工费": child.attrib["Rgf"],
  460. "主材费" : child.attrib["Zcf"],
  461. "设备费": child.attrib["Sbf"],
  462. "辅材费": child.attrib["Fcf"],
  463. "材料费" : child.attrib["Clf"],
  464. "机械费" : child.attrib["Jxf"],
  465. "管理费": child.attrib["Glf"],
  466. "利润": child.attrib["Lr"],
  467. "暂估价" : child.attrib["Zgj"],
  468. "综合人工工日" : child.attrib["Zgr"],
  469. "备注" : child.attrib["Bz"]}
  470. )
  471. for child_zj in child:
  472. if child_zj.tag == "Qdxdezj":
  473. for child_mx in child_zj:
  474. if child_mx.tag == "QdxdezjMx":
  475. parent = result[-1]
  476. if "__children" in parent:
  477. parent["__children"].append({
  478. "操作" : "",
  479. "序号": None, "清单编码" : child_mx.attrib["Debm"], "名称" : child_mx.attrib["Mc"],"项目特征" : None,
  480. "计算规则" : None,
  481. "单位" : child_mx.attrib["Dw"],
  482. "数量": child_mx.attrib["DwQdSl"],
  483. "综合单价" : child_mx.attrib["Dj"],
  484. "合价" : child_mx.attrib["Hj"],
  485. "人工费": child_mx.attrib["Rgf"],
  486. "主材费" : child_mx.attrib["Zcf"],
  487. "设备费": child_mx.attrib["Sbf"],
  488. "辅材费": child_mx.attrib["Fcf"],
  489. "材料费" : child_mx.attrib["Clf"],
  490. "机械费" : child_mx.attrib["Jxf"],
  491. "管理费": child_mx.attrib["Glf"],
  492. "利润": child_mx.attrib["Lr"],
  493. "暂估价" : None,
  494. "综合人工工日" : None,
  495. "备注" : None}
  496. )
  497. else:
  498. parent["__children"] = [{
  499. "操作" : "",
  500. "序号": None, "清单编码" : child_mx.attrib["Debm"], "名称" : child_mx.attrib["Mc"],"项目特征" : None,
  501. "计算规则" : None,
  502. "单位" : child_mx.attrib["Dw"],
  503. "数量": child_mx.attrib["DwQdSl"],
  504. "综合单价" : child_mx.attrib["Dj"],
  505. "合价" : child_mx.attrib["Hj"],
  506. "人工费": child_mx.attrib["Rgf"],
  507. "主材费" : child_mx.attrib["Zcf"],
  508. "设备费": child_mx.attrib["Sbf"],
  509. "辅材费": child_mx.attrib["Fcf"],
  510. "材料费" : child_mx.attrib["Clf"],
  511. "机械费" : child_mx.attrib["Jxf"],
  512. "管理费": child_mx.attrib["Glf"],
  513. "利润": child_mx.attrib["Lr"],
  514. "暂估价" : None,
  515. "综合人工工日" : None,
  516. "备注" : None}]
  517. return result
  518. def getQdxm_addition(root, id):
  519. result = []
  520. #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
  521. item = None
  522. for child in root:
  523. if child.tag == "Dxgcxx":
  524. for child1 in child:
  525. Dwgcbh = child1.attrib["Dwgcbh"]
  526. if Dwgcbh == id:
  527. item = child1
  528. break
  529. ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
  530. Fywj = None
  531. for child in item:
  532. if child.tag == 'Qdxm':
  533. Fywj= child
  534. break
  535. for child in Fywj:
  536. ##child is mx
  537. if child.tag == "QdBt":
  538. count = 0
  539. for grandchild in child:
  540. count = count + 1
  541. if count > 0:
  542. result.append({'Bz': child.attrib["Bz"], 'Je': child.attrib['Je'], 'Mc': child.attrib['Mc'], 'Xh': child.attrib['Xh'], 'Zgj': child.attrib['Zgj']})
  543. return result
  544. def getQdxm(root, id):###qdxm下面既有qdmx,也有qdbt,qdbt可能为空
  545. result = []
  546. #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
  547. item = None
  548. for child in root:
  549. if child.tag == "Dxgcxx":
  550. for child1 in child:
  551. Dwgcbh = child1.attrib["Dwgcbh"]
  552. if Dwgcbh == id:
  553. item = child1
  554. break
  555. ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
  556. Fywj = None
  557. for child in item:
  558. if child.tag == 'Qdxm':
  559. Fywj= child
  560. break
  561. for child in Fywj:
  562. ##child is mx
  563. if child.tag == 'Qdmx':
  564. if 'Default' in result:
  565. pass
  566. else:
  567. result.append('Default')
  568. if child.tag == "QdBt":
  569. count = 0
  570. for grandchild in child:
  571. count = count + 1
  572. if count > 0:
  573. result.append(child.attrib["Mc"])
  574. return result
  575. def getZjcs(root, id):
  576. result = []
  577. #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
  578. item = None
  579. for child in root:
  580. if child.tag == "Dxgcxx":
  581. for child1 in child:
  582. Dwgcbh = child1.attrib["Dwgcbh"]
  583. if Dwgcbh == id:
  584. item = child1
  585. break
  586. ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
  587. Fywj = None
  588. for child in item:
  589. if child.tag == 'Csxm':
  590. Fywj= child
  591. break
  592. Zjcs_parent = None
  593. for child in Fywj:
  594. if child.tag == 'ZjCs':
  595. Zjcs_parent = child
  596. break
  597. for child in Zjcs_parent:
  598. ##child is mx {
  599. result.append({
  600. "序号" : child.attrib["Xh"], "清单编码": child.attrib["Bm"], "名称" : child.attrib["Mc"],
  601. "计算基数" : child.attrib["Js"],
  602. "计算基础" : child.attrib["Jsjc"], "费率" : child.attrib["Fl"],
  603. "金额" : child.attrib["Je"], "项目类别" : child.attrib["Xmlb"]})
  604. __children = []
  605. for grandchild in child:
  606. __children.append({
  607. "序号" : None, "清单编码": None, "名称" : grandchild.attrib["Mc"],
  608. "计算基数" : grandchild.attrib["Js"],
  609. "计算基础" : grandchild.attrib["Jsjc"], "费率" : grandchild.attrib["Fl"],
  610. "金额" : grandchild.attrib["Je"], "项目类别" : grandchild.attrib["Xmlb"]})
  611. if len(__children) > 0:
  612. result[-1]["__children"] = __children
  613. return result
  614. def getZcbfwf(root, id):
  615. result = []
  616. #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
  617. item = None
  618. for child in root:
  619. if child.tag == "Dxgcxx":
  620. for child1 in child:
  621. Dwgcbh = child1.attrib["Dwgcbh"]
  622. if Dwgcbh == id:
  623. item = child1
  624. break
  625. ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
  626. Fywj = None
  627. for child in item:
  628. if child.tag == 'Zcbfwf':
  629. Fywj= child
  630. break
  631. for child in Fywj:
  632. result.append(
  633. {'序号': child.attrib["Xh"],
  634. "名称" : child.attrib["Mc"], "项目价值" : child.attrib["Xmjz"], "服务内容" :child.attrib["Fwnr"], "计算基础" :child.attrib["Jsjc"],
  635. "费率" :child.attrib["Fl"], "金额" :child.attrib["Je"]}
  636. )
  637. return result
  638. def getRcjhz(root, id):
  639. result = [[ "ID", "编码", "名称", "规格型号", "单位", "数量", "单价", "合价", "产地",
  640. "供应厂商", "人材机类别", "主要材料标志", "主材标志", "设备标志", "甲供标志", "暂估价标志"]]
  641. for child in root:
  642. if child.tag == "Dxgcxx":
  643. for child1 in child:
  644. Dwgcbh = child1.attrib["Dwgcbh"]
  645. if Dwgcbh == id:
  646. item = child1
  647. break
  648. ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
  649. Fywj = None
  650. for child in item:
  651. if child.tag == 'Rcjhz':
  652. Fywj= child
  653. break
  654. for child in Fywj:
  655. result.append(
  656. [
  657. child.attrib["RcjId"], child.attrib["RcjBm"], child.attrib["Mc"], child.attrib["Ggxh"],
  658. child.attrib["Dw"], child.attrib["Sl"], child.attrib["Dj"], child.attrib["Hj"],
  659. child.attrib["Cd"], child.attrib["Gycs"], child.attrib["Rcjlb"],
  660. child.attrib["Zyclbz"], child.attrib["Zcbz"], child.attrib["Sbbz"], child.attrib["Jgbz"],
  661. child.attrib["Zgjbz"]]
  662. )
  663. return result
  664. def getFbrgycl(root, id):
  665. result = []
  666. for child in root:
  667. if child.tag == "Dxgcxx":
  668. for child1 in child:
  669. Dwgcbh = child1.attrib["Dwgcbh"]
  670. if Dwgcbh == id:
  671. item = child1
  672. break
  673. ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
  674. Fywj = None
  675. for child in item:
  676. if child.tag == 'Fbrgycl':
  677. Fywj= child
  678. break
  679. for child in Fywj:
  680. result.append(
  681. {'序号': child.attrib["Xh"],
  682. 'ID': child.attrib["RcjId"], '材料编号': child.attrib["Clbh"], '名称': child.attrib["Mc"], '规格型号': child.attrib["Ggxh"],
  683. '单位': child.attrib["Dw"], '数量': child.attrib["Sl"], '单价': child.attrib["Dj"], '合价': child.attrib["Hj"], '交货方式': child.attrib["Jhfs"],
  684. '送达地点': child.attrib["Sddd"], '备注': child.attrib["Bz"]}
  685. )
  686. return result
  687. def getJrg(root, id):
  688. result = []
  689. #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
  690. item = None
  691. for child in root:
  692. if child.tag == "Dxgcxx":
  693. for child1 in child:
  694. Dwgcbh = child1.attrib["Dwgcbh"]
  695. if Dwgcbh == id:
  696. item = child1
  697. break
  698. ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
  699. Fywj = None
  700. for child in item:
  701. if child.tag == 'Jrg':
  702. Fywj= child
  703. break
  704. for child in Fywj:
  705. result.append(
  706. {'序号': child.attrib["Xh"],
  707. '名称': child.attrib["Mc"], '金额': child.attrib["Je"], '类别': child.attrib["Lb"]}
  708. )
  709. return result
  710. def getZlje(root, id):
  711. result = []
  712. #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
  713. item = None
  714. for child in root:
  715. if child.tag == "Dxgcxx":
  716. for child1 in child:
  717. Dwgcbh = child1.attrib["Dwgcbh"]
  718. if Dwgcbh == id:
  719. item = child1
  720. break
  721. ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
  722. Fywj = None
  723. for child in item:
  724. if child.tag == 'Zlje':
  725. Fywj= child
  726. break
  727. for child in Fywj:
  728. result.append(
  729. {'序号': child.attrib["Xh"],
  730. '名称': child.attrib["Mc"], '单位': child.attrib["Dw"], '暂定金额': child.attrib["Zdje"], '备注': child.attrib["Bz"]}
  731. )
  732. return result
  733. def getZygczgj(root, id):
  734. result = []
  735. #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
  736. item = None
  737. for child in root:
  738. if child.tag == "Dxgcxx":
  739. for child1 in child:
  740. Dwgcbh = child1.attrib["Dwgcbh"]
  741. if Dwgcbh == id:
  742. item = child1
  743. break
  744. ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
  745. Fywj = None
  746. for child in item:
  747. if child.tag == 'Zygczg':
  748. Fywj= child
  749. break
  750. for child in Fywj:
  751. result.append(
  752. {'序号': child.attrib["Xh"],
  753. '名称': child.attrib["Mc"], '工程内容': child.attrib["Gcnr"], '金额': child.attrib["Je"], '备注': child.attrib["Bz"]}
  754. )
  755. return result
  756. def getQtxm(root, id):
  757. result = []
  758. #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
  759. item = None
  760. for child in root:
  761. if child.tag == "Dxgcxx":
  762. for child1 in child:
  763. Dwgcbh = child1.attrib["Dwgcbh"]
  764. if Dwgcbh == id:
  765. item = child1
  766. break
  767. ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
  768. Fywj = None
  769. for child in item:
  770. if child.tag == 'Qtxm':
  771. Fywj= child
  772. break
  773. for child in Fywj:
  774. ##child is mx
  775. xh = child.attrib["Xh"]
  776. if "." in xh:
  777. count = 0
  778. for entry in xh:
  779. if entry == ".":
  780. count = count + 1
  781. if count == 1:
  782. parent = result[-1]
  783. if "__children" in parent:
  784. children = parent["__children"]
  785. children.append(
  786. {"序号":xh, "名称": child.attrib["Mc"],
  787. "金额": child.attrib["Je"], "项目类别" : child.attrib["Xmlb"], "备注" : child.attrib["Bz"]}
  788. )
  789. else:
  790. parent["__children"] = [
  791. {"序号":xh, "名称": child.attrib["Mc"],
  792. "金额": child.attrib["Je"], "项目类别" : child.attrib["Xmlb"], "备注" : child.attrib["Bz"]}]
  793. else:
  794. result.append(
  795. {"序号":xh, "名称": child.attrib["Mc"],
  796. "金额": child.attrib["Je"], "项目类别" : child.attrib["Xmlb"], "备注" : child.attrib["Bz"]}
  797. )
  798. return result
  799. def getGfsj(root, id):
  800. result = []
  801. #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
  802. item = None
  803. for child in root:
  804. if child.tag == "Dxgcxx":
  805. for child1 in child:
  806. Dwgcbh = child1.attrib["Dwgcbh"]
  807. if Dwgcbh == id:
  808. item = child1
  809. break
  810. ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
  811. Fywj = None
  812. for child in item:
  813. if child.tag == 'Gfsj':
  814. Fywj= child
  815. break
  816. for child in Fywj:
  817. ##child is mx
  818. xh = child.attrib["Xh"]
  819. if "." in xh:
  820. count = 0
  821. for entry in xh:
  822. if entry == ".":
  823. count = count + 1
  824. if count == 1:
  825. parent = result[-1]
  826. if "__children" in parent:
  827. children = parent["__children"]
  828. children.append({"序号":xh, "名称": child.attrib["Mc"], "取费基数": child.attrib["Qfjs"], "计算基础": child.attrib["Jsjc"], "费率": child.attrib['Fl'], "金额": child.attrib["Je"], "类别" : child.attrib["Fyxlb"]})
  829. else:
  830. parent["__children"] = [{"序号":xh, "名称": child.attrib["Mc"], "取费基数": child.attrib["Qfjs"], "计算基础": child.attrib["Jsjc"], "费率": child.attrib['Fl'], "金额": child.attrib["Je"], "类别" : child.attrib["Fyxlb"]}]
  831. elif count == 2:
  832. parent = result[-1]
  833. if "__children" in parent:
  834. parent = parent["__children"][-1]
  835. print(parent)
  836. if "__children" in parent:
  837. children = parent["__children"]
  838. children.append({"序号":xh, "名称": child.attrib["Mc"], "取费基数": child.attrib["Qfjs"], "计算基础": child.attrib["Jsjc"], "费率": child.attrib['Fl'], "金额": child.attrib["Je"], "类别" : child.attrib["Fyxlb"]})
  839. else:
  840. parent["__children"] = [{"序号":xh, "名称": child.attrib["Mc"], "取费基数": child.attrib["Qfjs"], "计算基础": child.attrib["Jsjc"], "费率": child.attrib['Fl'], "金额": child.attrib["Je"], "类别" : child.attrib["Fyxlb"]}]
  841. else:
  842. ###["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
  843. result.append({"序号":xh, "名称": child.attrib["Mc"], "取费基数": child.attrib["Qfjs"], "计算基础": child.attrib["Jsjc"], "费率": child.attrib['Fl'], "金额": child.attrib["Je"], "类别" : child.attrib["Fyxlb"]})
  844. return result
  845. def getBjhz(root, id):
  846. print(root)
  847. print(id)
  848. result = []
  849. #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
  850. item = None
  851. for child in root:
  852. if child.tag == "Dxgcxx":
  853. for child1 in child:
  854. Dwgcbh = child1.attrib["Dwgcbh"]
  855. if Dwgcbh == id:
  856. item = child1
  857. break
  858. ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
  859. print(item)
  860. Fywj = None
  861. for child in item:
  862. if child.tag == 'Fywj':
  863. Fywj= child
  864. break
  865. for child in Fywj:
  866. ##child is mx
  867. xh = child.attrib["Xh"]
  868. if "." in xh:
  869. count = 0
  870. for entry in xh:
  871. if entry == ".":
  872. count = count + 1
  873. if count == 1:
  874. parent = result[-1]
  875. if "__children" in parent:
  876. children = parent["__children"]
  877. children.append({"序号":xh, "名称": child.attrib["Mc"], "金额": child.attrib["Je"], "暂估价" : child.attrib["Zgj"], "类别" : child.attrib["Fyxlb"]})
  878. else:
  879. parent["__children"] = [{"序号":xh, "名称": child.attrib["Mc"], "金额": child.attrib["Je"], "暂估价" : child.attrib["Zgj"], "类别" : child.attrib["Fyxlb"]}]
  880. elif count == 2:
  881. parent = result[-1]
  882. if "__children" in parent:
  883. parent = parent["__children"][-1]
  884. print(parent)
  885. if "__children" in parent:
  886. children = parent["__children"]
  887. children.append({"序号":xh, "名称": child.attrib["Mc"], "金额": child.attrib["Je"], "暂估价" : child.attrib["Zgj"], "类别" : child.attrib["Fyxlb"]})
  888. else:
  889. parent["__children"] = [{"序号":xh, "名称": child.attrib["Mc"], "金额": child.attrib["Je"], "暂估价" : child.attrib["Zgj"], "类别" : child.attrib["Fyxlb"]}]
  890. else:
  891. ###"序号", "名称", "金额", "暂估价", "类别"]
  892. result.append({"序号":xh, "名称": child.attrib["Mc"], "金额": child.attrib["Je"],
  893. "暂估价" : child.attrib["Zgj"], "类别" : child.attrib["Fyxlb"]})
  894. return result
  895. def processDes(dataframe, from_, end, level):
  896. result = []
  897. for i in range(from_, end):
  898. item = dataframe.iloc[i]
  899. fbcch = str(item['fbcch'])
  900. if fbcch == str(level):
  901. entry = {"id": str(item["ID"]),"key": str(item["ID"]), "value": str(item["ID"]), "label": str(item["zjbt"]), "title": str(item["zjbt"])}
  902. next = i + 1
  903. while next < end and str(dataframe.iloc[next]["fbcch"]) != str(level):
  904. next = next + 1
  905. entry["children"] = processDes(dataframe, i + 1, next, level + 1)
  906. result.append(entry)
  907. return result
  908. def processPbs(dataframe, from_, end, level):
  909. result = []
  910. for i in range(from_, end):
  911. item = dataframe.iloc[i]
  912. fbcch = str(item['fbcch'])
  913. if fbcch == str(level):
  914. entry = {"id": str(item["ID"]),"key": str(item["ID"]), "value": str(item["ID"]), "label": str(item["flmc"]),"title": str(item["flmc"]), "data": item["pblbh"]}
  915. next = i + 1
  916. while next < end and str(dataframe.iloc[next]["fbcch"]) != str(level):
  917. next = next + 1
  918. entry["children"] = processPbs(dataframe, i + 1, next, level + 1)
  919. result.append(entry)
  920. return result
  921. def getCankao():
  922. tree = ET.parse('de/DeData_Fl.xml')
  923. root = tree.getroot()
  924. JSFF = None
  925. CsFl = None
  926. result = []
  927. for child in root:
  928. if child.tag == "JJFF":
  929. for grandchild in child:
  930. if grandchild.tag == 'JSFF':
  931. JSFF = grandchild
  932. for child in JSFF:
  933. if child.attrib['Markup'] == '1':
  934. for grandchild in child:
  935. if grandchild.tag == 'CsFl':
  936. CsFl = grandchild
  937. for child in CsFl:
  938. result.append({'工程类型': child.attrib['Gclx'], '名称': child.attrib['Mc'], '计算基础': child.attrib['Jsjc'],
  939. '参考费率': child.attrib['CkFl'], '地区': child.attrib['Dq'], '备注': child.attrib['Bz']})
  940. return result
  941. def getDes(value):
  942. if value == 10:
  943. shu = pd.read_csv("de/tj/JD_DingEShu.csv")
  944. elif value == 20:
  945. shu = pd.read_csv("de/sz/JD_DingEShu.csv")
  946. elif value == 30:
  947. shu = pd.read_csv("de/az/JD_DingEShu.csv")
  948. elif value == 40:
  949. shu = pd.read_csv("de/yl/JD_DingEShu.csv")
  950. elif value == 50:
  951. shu = pd.read_csv("de/xstj/JD_DingEShu.csv")
  952. else:
  953. shu = pd.read_csv("de/xsaz/JD_DingEShu.csv")
  954. length = len(shu)
  955. return processDes(shu, 1, length, 2)
  956. def getPbs(value):
  957. if value == 10:
  958. shu = pd.read_csv("de/tj/JD_PeiBiFLB.csv")
  959. else:
  960. shu = pd.read_csv("de/sz/JD_PeiBiFLB.csv")
  961. length = len(shu)
  962. return processPbs(shu, 0, length, 1)
  963. def read_singledexilie_azfy(debh):
  964. id = "None"
  965. if "-F1" in debh:
  966. id = "2076"
  967. elif "-F2" in debh:
  968. id = "2077"
  969. elif "-F3" in debh:
  970. id = "2078"
  971. elif "-F4" in debh:
  972. id = "2079"
  973. elif "-F5" in debh:
  974. id = "2080"
  975. elif "-F6" in debh:
  976. id = "2081"
  977. r_debh = debh.split("#")[0]
  978. if len(debh.split("#")) == 1:
  979. return json.dumps({
  980. "reverse": id,
  981. "rgde": [],
  982. "jxde": [],
  983. "clde": [],
  984. "actual_zhuanye": 30,
  985. "bz_selected": {"BZBH": {}},
  986. "bz_selected2": {"BZBH": {}}
  987. }, ensure_ascii=False)
  988. gclmc = debh.split("#")[1]
  989. return json.dumps({
  990. "reverse": id,
  991. "DEBH": {"111": r_debh},
  992. "GCLMC": {"111": gclmc},
  993. "DW": {"111": '项'},
  994. "rgde": [],
  995. "jxde": [],
  996. "clde": [],
  997. "actual_zhuanye": 30,
  998. "bz_selected": {"BZBH": {}},
  999. "bz_selected2": {"BZBH": {}}
  1000. }, ensure_ascii=False)
  1001. def getDeXilie_azfy(value, id):
  1002. if int(id) == 2075:
  1003. return "{\"Unnamed: 0\":{},\"id\":{},\"DEBH\":{},\"GCLMC\":{},\"GCLGG\":{},\"GCLRGR\":{},\"GCLCLF\":{},\"GCLJXF\":{},\"GCLRGF\":{},\"GCLGLF\":{},\"GLFFL\":{},\"GCLLR\":{},\"LRFL\":{},\"PBSL\":{},\"GCLJJ\":{},\"GCLSJDJ\":{},\"PBBH\":{},\"GCPBHJ\":{},\"DW\":{},\"PBDJ\":{},\"PBBHM\":{},\"GCLCLF1\":{},\"THMC\":{},\"YSDELBH\":{},\"THSL\":{},\"GLDE\":{},\"BZBH\":{},\"rglxh\":{},\"zhxs\":{},\"zmsm\":{},\"is_lock\":{},\"dejb\":{},\"sptfl\":{},\"work\":{},\"zhiyin\":{},\"qfbz\":{},\"ischaogao\":{},\"zmlx\":{},\"BH1\":{},\"BH2\":{},\"mcxz\":{},\"DeId\":{}}"
  1004. if int(id) == 2076:
  1005. data = {'DW': ['项', '项', '项', '项', '项', '项', '项', '项', "项", "项", "项", "项", "项", "项", "项", "项"],
  1006. 'DEBH': ['2-F1', '2-F1', '3-F1', '3-F1', '4-F1',
  1007. '5-F1', '6-F1', '7-F1', '8-F1', '9-F1', '10-F1', '11-F1', '11-F1', '11-F1', '11-F1', '11-F1'],
  1008. "GCLMC": ["第二册第1-5章(定额2-1~2-390)", "第二册第6章(定额2-391~2-9999)", "第三册静置设备制作(定额3-1~3-615)",
  1009. "第三册除静置设备制作以外(定额3-616~3-9999)", "第四册",
  1010. "第五册", "第六册", "第七册", "第八册", "第九册", "第十册",
  1011. "第十一册刷油工程(定额11-51~11-329)",
  1012. "第十一册防腐蚀工程(定额11-330~11-1689)", "第十一册绝热工程(定额11-1690~11-2327)", "第十一册除锈工程(定额11-1~11-50)刷油工程", "第十一册除锈工程(定额11-1~11-50)防腐蚀工程"],
  1013. "GCLSJDJ": ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"]}
  1014. df = pd.DataFrame(data)
  1015. return df.to_json(force_ascii=False)
  1016. if int(id) == 2077:
  1017. data = {'DW': ['项', '项', '项', '项', '项', '项', '项', '项','项','项',
  1018. '项','项','项','项','项','项','项','项','项','项',
  1019. '项','项','项',
  1020. '项','项', "项",'项','项','项','项', "项",'项', "项"],
  1021. 'DEBH': ['1-F2', '1-F2','1-F2','1-F2','1-F2','1-F2','1-F2','1-F2','1-F2','1-F2','1-F2','1-F2',
  1022. '4-F2', '5-F2', '5-F2', '5-F2','6-F2',
  1023. '7-F2', '9-F2','9-F2','9-F2','9-F2', '10-F2','10-F2','10-F2','10-F2',
  1024. '11-F2','11-F2','11-F2','11-F2', '11-F2','11-F2','11-F2' ],
  1025. "GCLMC": ["第一册第1-6章(定额1-1~1-571)10-15m",
  1026. "第一册第1-6章(定额1-1~1-571)15-20m",
  1027. "第一册第1-6章(定额1-1~1-571)20-25m",
  1028. "第一册第1-6章(定额1-1~1-571)25-30m",
  1029. "第一册第1-6章(定额1-1~1-571)30-40m",
  1030. "第一册第1-6章(定额1-1~1-571)40m以上",
  1031. "第一册第8-14章(定额1-672~1-9999)10-15m",
  1032. "第一册第8-14章(定额1-672~1-9999)15-20m",
  1033. "第一册第8-14章(定额1-672~1-9999)20-25m",
  1034. "第一册第8-14章(定额1-672~1-9999)25-30m",
  1035. "第一册第8-14章(定额1-672~1-9999)30-40m",
  1036. "第一册第8-14章(定额1-672~1-9999)40m以上",
  1037. "第四册",
  1038. "第五册5m以上到10m以内",
  1039. "第五册10-20m",
  1040. "第五册20m以上",
  1041. "第六册", "第七册",
  1042. "第九册5m以上到8m以内",
  1043. "第九册8-12m",
  1044. "第九册12-16m",
  1045. "第九册16-20m",
  1046. "第十册3.6-8m以内",
  1047. "第十册8-12m以内",
  1048. "第十册12-16m以内",
  1049. "第十册16-20m",
  1050. "第十一册6-20m",
  1051. "第十一册20-30m",
  1052. "第十一册30-40m",
  1053. "第十一册40-50m",
  1054. "第十一册50-60m",
  1055. "第十一册60-70m",
  1056. "第十一册80m以上",
  1057. ],
  1058. "GCLSJDJ": ["0", "0", '0', '0',"0", "0", "0", "0", "0", "0",
  1059. "0", "0", '0', '0',"0", "0", "0", "0", "0", "0",
  1060. "0","0", "0",
  1061. "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"]}
  1062. df = pd.DataFrame(data)
  1063. return df.to_json(force_ascii=False)
  1064. def getDeXilie(value, id):
  1065. print(type(id))
  1066. if value == 10:
  1067. shu = pd.read_csv("de/tj/JD_DingEShu.csv")
  1068. elif value == 20:
  1069. shu = pd.read_csv("de/sz/JD_DingEShu.csv")
  1070. elif value == 30:
  1071. shu = pd.read_csv("de/az/JD_DingEShu.csv")
  1072. elif value == 40:
  1073. shu = pd.read_csv("de/yl/JD_DingEShu.csv")
  1074. elif value == 50:
  1075. shu = pd.read_csv("de/xstj/JD_DingEShu.csv")
  1076. else:
  1077. shu = pd.read_csv("de/xsaz/JD_DingEShu.csv")
  1078. hit = shu[shu["ID"]==int(id)]
  1079. print(hit)
  1080. if len(hit) == 0:
  1081. return []
  1082. hit0 = hit.iloc[0]
  1083. index = str(hit0['zjh'])
  1084. print("index=" + index)
  1085. if value == 10:
  1086. gj = pd.read_csv("de/tj/JD_DanWeiGJ.csv")
  1087. filtered = gj[gj["YSDELBH"]==int(index)]
  1088. elif value == 20:
  1089. gj = pd.read_csv("de/sz/JD_DanWeiGJ.csv")
  1090. filtered = gj[gj["YSDELBH"]==(index)]
  1091. elif value == 30:
  1092. gj = pd.read_csv("de/az/JD_DanWeiGJ.csv")
  1093. filtered = gj[gj["YSDELBH"]==(index)]
  1094. elif value == 40:
  1095. gj = pd.read_csv("de/yl/JD_DanWeiGJ.csv")
  1096. filtered = gj[gj["YSDELBH"]==int(index)]
  1097. elif value == 50:
  1098. gj = pd.read_csv("de/xstj/JD_DanWeiGJ.csv")
  1099. filtered = gj[gj["YSDELBH"]==int(index)]
  1100. else:
  1101. gj = pd.read_csv("de/xsaz/JD_DanWeiGJ.csv")
  1102. filtered = gj[gj["YSDELBH"]==int(index)]
  1103. return filtered.to_json(force_ascii=False)
  1104. def getQufei(name):
  1105. if name == "0":
  1106. gj = pd.read_csv("de/tj/JD_PeiBi.csv")
  1107. return gj.to_json(force_ascii=False)
  1108. shu = pd.read_csv("de/tj/JD_PeiBiFLB.csv")
  1109. hit = shu[shu["ID"]==int(name)]
  1110. print(hit)
  1111. if len(hit) == 0:
  1112. return []
  1113. hit0 = hit.iloc[0]
  1114. index = str(hit0['pblbh'])
  1115. index_list = index.split(";")
  1116. gj = pd.read_csv("de/tj/JD_PeiBi.csv")
  1117. filtered = gj[gj["PBBH"].str.startswith(tuple(index_list))]
  1118. return filtered.to_json(force_ascii=False)
  1119. def getPbxl(name):
  1120. if name == "0":
  1121. gj = pd.read_csv("de/tj/JD_PeiBi.csv")
  1122. return gj.to_json(force_ascii=False)
  1123. shu = pd.read_csv("de/tj/JD_PeiBiFLB.csv")
  1124. hit = shu[shu["ID"]==int(name)]
  1125. print(hit)
  1126. if len(hit) == 0:
  1127. return []
  1128. hit0 = hit.iloc[0]
  1129. index = str(hit0['pblbh'])
  1130. index_list = index.split(";")
  1131. gj = pd.read_csv("de/tj/JD_PeiBi.csv")
  1132. filtered = gj[gj["PBBH"].str.startswith(tuple(index_list))]
  1133. return filtered.to_json(force_ascii=False)
  1134. def getSingleDeXilie(zhuanye, debh):
  1135. if zhuanye == 10:
  1136. A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_tj(debh)
  1137. if A1:
  1138. return A1, A2, A3, A4, A5, A6, A7, 10
  1139. else:
  1140. A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_sz(debh)
  1141. return A1, A2, A3, A4,A5, A6, A7, 20
  1142. elif zhuanye == 20:##shizheng
  1143. A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_sz(debh)
  1144. if A1:
  1145. return A1, A2, A3, A4, A5, A6, A7, 20
  1146. else:
  1147. A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_tj(debh)
  1148. if A1:
  1149. return A1, A2, A3, A4, A5, A6, A7, 10
  1150. else:
  1151. A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_az(debh)
  1152. return A1, A2, A3, A4, A5, A6, A7, 30
  1153. elif zhuanye == 30:##anzhuang
  1154. A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_az(debh)
  1155. return A1, A2, A3, A4, A5, A6, A7, 30
  1156. elif zhuanye == 40:##yuanlin
  1157. A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_yl(debh)
  1158. return A1, A2, A3, A4, A5, A6, A7, 40
  1159. elif zhuanye == 50: ## xiushan tujian
  1160. A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_xstj(debh)
  1161. if A1:
  1162. return A1, A2, A3, A4, A5, A6, A7, 50
  1163. else:
  1164. A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_tj(debh)
  1165. return A1, A2, A3, A4,A5, A6, A7, 10
  1166. else:
  1167. A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_xsaz(debh)
  1168. if A1:
  1169. return A1, A2, A3, A4, A5, A6, A7, 60
  1170. else:
  1171. A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_az(debh)
  1172. return A1, A2, A3, A4,A5, A6, A7, 30
  1173. def getSingleDeXilie_xsaz(debh):
  1174. id = None
  1175. bz_selected = []
  1176. bz_selected2 = []
  1177. if "附注" in debh:
  1178. position = debh.find("附注")
  1179. debh = debh[:position]
  1180. if "*" in debh:
  1181. position = debh.find("*")
  1182. debh = debh[:position]
  1183. if debh.endswith("换"):
  1184. debh = debh[:-1]
  1185. if "[" in debh:
  1186. position = debh.find("[")
  1187. debh = debh[:position-1]
  1188. gj = pd.read_csv("de/xsaz/JD_DanWeiGJ.csv")
  1189. filtered = gj[gj["DEBH"]==debh]
  1190. print(filtered)
  1191. if len(filtered) > 0:
  1192. index = (filtered.iloc[0]["YSDELBH"])
  1193. shu = pd.read_csv("de/xsaz/JD_DingEShu.csv")
  1194. hit = shu[shu["zjh"]==index]
  1195. if len(hit) > 0:
  1196. id = hit.iloc[0]["ID"]
  1197. beizhu = str(filtered.iloc[0]["BZBH"])
  1198. if 'nan' in beizhu:
  1199. pass
  1200. else:
  1201. beizhus = beizhu.split(";")
  1202. print(beizhus)
  1203. bzfile = pd.read_csv("de/xsaz/JD_BeiZhuZK.csv")
  1204. bzfile2 = pd.read_csv("de/xsaz/JD_BeiZhuFK.csv", dtype=str)
  1205. bz_selected = bzfile[bzfile["BZBH"].isin(beizhus)]
  1206. bz_selected2 = bzfile2[bzfile2["BZBH"].isin(beizhus)]
  1207. else:
  1208. return None, None, None, None, None, None, None
  1209. ####rengong
  1210. rgde = []
  1211. rg = pd.read_csv("de/xsaz/JD_GuJiaRG.csv")
  1212. filtered1 = rg[rg["DEBH"]==debh]
  1213. for i in range(len(filtered1)):
  1214. rgde_ = {}
  1215. gr = filtered1.iloc[i]["RGR"]##gongri
  1216. gf = filtered1.iloc[i]["RGF"]##gongfei
  1217. rcjID = filtered1.iloc[i]["RcjID"]
  1218. detail = pd.read_csv("de/xsaz/JD_CaiLiaoK.csv")
  1219. filtered2 = detail[detail["RcjID"]==rcjID]
  1220. if len(filtered2) > 0:
  1221. CLBH = filtered2.iloc[0]["CLBH"]
  1222. CLMC = filtered2.iloc[0]["CLMC"]
  1223. JLDW = filtered2.iloc[0]["JLDW"]
  1224. YSJG = filtered2.iloc[0]["YSJG"]
  1225. rgde_["CLBH"] = CLBH
  1226. rgde_["CLMC"] = CLMC
  1227. rgde_["JLDW"] = JLDW
  1228. rgde_["YSJG"] = YSJG.item()
  1229. rgde_["gr"] = gr.item()
  1230. rgde_["gf"] = gf.item()
  1231. rgde.append(rgde_)
  1232. ##print(rgde)
  1233. ####jixie
  1234. jxde = []
  1235. jx = pd.read_csv("de/xsaz/JD_GuJiaJX.csv")
  1236. filtered1 = jx[jx["DEBH"]==debh]
  1237. for i in range(len(filtered1)):
  1238. jxde_ = {}
  1239. sl = filtered1.iloc[i]["SL"]##shuliang
  1240. hj = filtered1.iloc[i]["HJ"]##hejia
  1241. rcjID = filtered1.iloc[i]["RcjID"]
  1242. detail = pd.read_csv("de/xsaz/JD_JiXieK.csv")
  1243. filtered2 = detail[detail["RcjID"]==rcjID]
  1244. if len(filtered2) > 0:
  1245. jxbh = filtered2.iloc[0]["jxbh"]
  1246. jxmc = filtered2.iloc[0]["jxmc"]
  1247. DW = filtered2.iloc[0]["DW"]
  1248. tbdj = filtered2.iloc[0]["tbdj"]
  1249. jxde_["jxbh"] = jxbh
  1250. jxde_["jxmc"] = jxmc
  1251. jxde_["DW"] = DW
  1252. jxde_["tbdj"] = tbdj.item()
  1253. jxde_["sl"] = sl.item()
  1254. jxde_["hj"] = hj.item()
  1255. jxde.append(jxde_)
  1256. ####cailiao
  1257. clde = []
  1258. cl = pd.read_csv("de/xsaz/JD_GuJiaCL.csv")
  1259. filtered1 = cl[cl["DEBH"]==debh]
  1260. for i in range(len(filtered1)):
  1261. clde_ = {}
  1262. SL = filtered1.iloc[i]["SL"]##shuliang
  1263. HJ = filtered1.iloc[i]["HJ"]##hejia
  1264. rcjID = filtered1.iloc[i]["RcjID"]
  1265. detail = pd.read_csv("de/xsaz/JD_CaiLiaoK.csv")
  1266. filtered2 = detail[detail["RcjID"]==rcjID]
  1267. if len(filtered2) > 0:
  1268. CLBH = filtered2.iloc[0]["CLBH"]
  1269. CLMC = filtered2.iloc[0]["CLMC"]
  1270. JLDW = filtered2.iloc[0]["JLDW"]
  1271. YSJG = filtered2.iloc[0]["YSJG"]
  1272. clde_["CLBH"] = CLBH
  1273. clde_["CLMC"] = CLMC
  1274. clde_["JLDW"] = JLDW
  1275. clde_["YSJG"] = YSJG.item()
  1276. clde_["SL"] = SL.item()
  1277. clde_["HJ"] = HJ.item()
  1278. clde.append(clde_)
  1279. else:
  1280. detail = pd.read_csv("de/xsaz/JD_PeiBi.csv")
  1281. filtered2 = detail[detail["RcjID"]==rcjID]
  1282. if len(filtered2) > 0:
  1283. CLBH = filtered2.iloc[0]["PBBH"]
  1284. CLMC = filtered2.iloc[0]["PBMC"]
  1285. JLDW = filtered2.iloc[0]["DW"]
  1286. YSJG = filtered2.iloc[0]["PBDJ"]
  1287. clde_["CLBH"] = CLBH.item()
  1288. clde_["CLMC"] = CLMC
  1289. clde_["JLDW"] = JLDW
  1290. clde_["YSJG"] = YSJG.item()
  1291. clde_["SL"] = SL.item()
  1292. clde_["HJ"] = HJ.item()
  1293. clde.append(clde_)
  1294. 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
  1295. def getSingleDeXilie_xstj(debh):
  1296. id = None
  1297. bz_selected = []
  1298. bz_selected2 = []
  1299. if "附注" in debh:
  1300. position = debh.find("附注")
  1301. debh = debh[:position]
  1302. if "*" in debh:
  1303. position = debh.find("*")
  1304. debh = debh[:position]
  1305. if debh.endswith("换"):
  1306. debh = debh[:-1]
  1307. if "[" in debh:
  1308. position = debh.find("[")
  1309. debh = debh[:position-1]
  1310. gj = pd.read_csv("de/xstj/JD_DanWeiGJ.csv")
  1311. filtered = gj[gj["DEBH"]==debh]
  1312. print(filtered)
  1313. if len(filtered) > 0:
  1314. index = (filtered.iloc[0]["YSDELBH"])
  1315. shu = pd.read_csv("de/xstj/JD_DingEShu.csv")
  1316. hit = shu[shu["zjh"]==index]
  1317. if len(hit) > 0:
  1318. id = hit.iloc[0]["ID"]
  1319. beizhu = str(filtered.iloc[0]["BZBH"])
  1320. if 'nan' in beizhu:
  1321. pass
  1322. else:
  1323. beizhus = beizhu.split(";")
  1324. print(beizhus)
  1325. bzfile = pd.read_csv("de/xstj/JD_BeiZhuZK.csv")
  1326. bzfile2 = pd.read_csv("de/xstj/JD_BeiZhuFK.csv", dtype=str)
  1327. bz_selected = bzfile[bzfile["BZBH"].isin(beizhus)]
  1328. bz_selected2 = bzfile2[bzfile2["BZBH"].isin(beizhus)]
  1329. else:
  1330. return None, None, None, None, None, None, None
  1331. ####rengong
  1332. rgde = []
  1333. rg = pd.read_csv("de/xstj/JD_GuJiaRG.csv")
  1334. filtered1 = rg[rg["DEBH"]==debh]
  1335. for i in range(len(filtered1)):
  1336. rgde_ = {}
  1337. gr = filtered1.iloc[i]["RGR"]##gongri
  1338. gf = filtered1.iloc[i]["RGF"]##gongfei
  1339. rcjID = filtered1.iloc[i]["RcjID"]
  1340. detail = pd.read_csv("de/xstj/JD_CaiLiaoK.csv")
  1341. filtered2 = detail[detail["RcjID"]==rcjID]
  1342. if len(filtered2) > 0:
  1343. CLBH = filtered2.iloc[0]["CLBH"]
  1344. CLMC = filtered2.iloc[0]["CLMC"]
  1345. JLDW = filtered2.iloc[0]["JLDW"]
  1346. YSJG = filtered2.iloc[0]["YSJG"]
  1347. rgde_["CLBH"] = CLBH
  1348. rgde_["CLMC"] = CLMC
  1349. rgde_["JLDW"] = JLDW
  1350. rgde_["YSJG"] = YSJG.item()
  1351. rgde_["gr"] = gr.item()
  1352. rgde_["gf"] = gf.item()
  1353. rgde.append(rgde_)
  1354. ##print(rgde)
  1355. ####jixie
  1356. jxde = []
  1357. jx = pd.read_csv("de/xstj/JD_GuJiaJX.csv")
  1358. filtered1 = jx[jx["DEBH"]==debh]
  1359. for i in range(len(filtered1)):
  1360. jxde_ = {}
  1361. sl = filtered1.iloc[i]["SL"]##shuliang
  1362. hj = filtered1.iloc[i]["HJ"]##hejia
  1363. rcjID = filtered1.iloc[i]["RcjID"]
  1364. detail = pd.read_csv("de/xstj/JD_JiXieK.csv")
  1365. filtered2 = detail[detail["RcjID"]==rcjID]
  1366. if len(filtered2) > 0:
  1367. jxbh = filtered2.iloc[0]["jxbh"]
  1368. jxmc = filtered2.iloc[0]["jxmc"]
  1369. DW = filtered2.iloc[0]["DW"]
  1370. tbdj = filtered2.iloc[0]["tbdj"]
  1371. jxde_["jxbh"] = jxbh
  1372. jxde_["jxmc"] = jxmc
  1373. jxde_["DW"] = DW
  1374. jxde_["tbdj"] = tbdj.item()
  1375. jxde_["sl"] = sl.item()
  1376. jxde_["hj"] = hj.item()
  1377. jxde.append(jxde_)
  1378. ####cailiao
  1379. clde = []
  1380. cl = pd.read_csv("de/xstj/JD_GuJiaCL.csv")
  1381. filtered1 = cl[cl["DEBH"]==debh]
  1382. for i in range(len(filtered1)):
  1383. clde_ = {}
  1384. SL = filtered1.iloc[i]["SL"]##shuliang
  1385. HJ = filtered1.iloc[i]["HJ"]##hejia
  1386. rcjID = filtered1.iloc[i]["RcjID"]
  1387. detail = pd.read_csv("de/xstj/JD_CaiLiaoK.csv")
  1388. filtered2 = detail[detail["RcjID"]==rcjID]
  1389. if len(filtered2) > 0:
  1390. CLBH = filtered2.iloc[0]["CLBH"]
  1391. CLMC = filtered2.iloc[0]["CLMC"]
  1392. JLDW = filtered2.iloc[0]["JLDW"]
  1393. YSJG = filtered2.iloc[0]["YSJG"]
  1394. clde_["CLBH"] = CLBH
  1395. clde_["CLMC"] = CLMC
  1396. clde_["JLDW"] = JLDW
  1397. clde_["YSJG"] = YSJG.item()
  1398. clde_["SL"] = SL.item()
  1399. clde_["HJ"] = HJ.item()
  1400. clde.append(clde_)
  1401. else:
  1402. detail = pd.read_csv("de/xstj/JD_PeiBi.csv")
  1403. filtered2 = detail[detail["RcjID"]==rcjID]
  1404. if len(filtered2) > 0:
  1405. CLBH = filtered2.iloc[0]["PBBH"]
  1406. CLMC = filtered2.iloc[0]["PBMC"]
  1407. JLDW = filtered2.iloc[0]["DW"]
  1408. YSJG = filtered2.iloc[0]["PBDJ"]
  1409. clde_["CLBH"] = CLBH.item()
  1410. clde_["CLMC"] = CLMC
  1411. clde_["JLDW"] = JLDW
  1412. clde_["YSJG"] = YSJG.item()
  1413. clde_["SL"] = SL.item()
  1414. clde_["HJ"] = HJ.item()
  1415. clde.append(clde_)
  1416. 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
  1417. def getSingleDeXilie_yl(debh):
  1418. id = None
  1419. bz_selected = []
  1420. bz_selected2 = []
  1421. if "附注" in debh:
  1422. position = debh.find("附注")
  1423. debh = debh[:position]
  1424. if "*" in debh:
  1425. position = debh.find("*")
  1426. debh = debh[:position]
  1427. if debh.endswith("换"):
  1428. debh = debh[:-1]
  1429. if "[" in debh:
  1430. position = debh.find("[")
  1431. debh = debh[:position-1]
  1432. gj = pd.read_csv("de/yl/JD_DanWeiGJ.csv")
  1433. filtered = gj[gj["DEBH"]==debh]
  1434. print(filtered)
  1435. if len(filtered) > 0:
  1436. index = (filtered.iloc[0]["YSDELBH"])
  1437. shu = pd.read_csv("de/yl/JD_DingEShu.csv")
  1438. hit = shu[shu["zjh"]==index]
  1439. if len(hit) > 0:
  1440. id = hit.iloc[0]["ID"]
  1441. beizhu = str(filtered.iloc[0]["BZBH"])
  1442. if 'nan' in beizhu:
  1443. pass
  1444. else:
  1445. beizhus = beizhu.split(";")
  1446. print(beizhus)
  1447. bzfile = pd.read_csv("de/yl/JD_BeiZhuZK.csv")
  1448. bzfile2 = pd.read_csv("de/yl/JD_BeiZhuFK.csv", dtype=str)
  1449. bz_selected = bzfile[bzfile["BZBH"].isin(beizhus)]
  1450. bz_selected2 = bzfile2[bzfile2["BZBH"].isin(beizhus)]
  1451. else:
  1452. return None, None, None, None, None, None, None
  1453. ####rengong
  1454. rgde = []
  1455. rg = pd.read_csv("de/yl/JD_GuJiaRG.csv")
  1456. filtered1 = rg[rg["DEBH"]==debh]
  1457. for i in range(len(filtered1)):
  1458. rgde_ = {}
  1459. gr = filtered1.iloc[i]["RGR"]##gongri
  1460. gf = filtered1.iloc[i]["RGF"]##gongfei
  1461. rcjID = filtered1.iloc[i]["RcjID"]
  1462. detail = pd.read_csv("de/yl/JD_CaiLiaoK.csv")
  1463. filtered2 = detail[detail["RcjID"]==rcjID]
  1464. if len(filtered2) > 0:
  1465. CLBH = filtered2.iloc[0]["CLBH"]
  1466. CLMC = filtered2.iloc[0]["CLMC"]
  1467. JLDW = filtered2.iloc[0]["JLDW"]
  1468. YSJG = filtered2.iloc[0]["YSJG"]
  1469. rgde_["CLBH"] = CLBH
  1470. rgde_["CLMC"] = CLMC
  1471. rgde_["JLDW"] = JLDW
  1472. rgde_["YSJG"] = YSJG.item()
  1473. rgde_["gr"] = gr.item()
  1474. rgde_["gf"] = gf.item()
  1475. rgde.append(rgde_)
  1476. ##print(rgde)
  1477. ####jixie
  1478. jxde = []
  1479. jx = pd.read_csv("de/yl/JD_GuJiaJX.csv")
  1480. filtered1 = jx[jx["DEBH"]==debh]
  1481. for i in range(len(filtered1)):
  1482. jxde_ = {}
  1483. sl = filtered1.iloc[i]["SL"]##shuliang
  1484. hj = filtered1.iloc[i]["HJ"]##hejia
  1485. rcjID = filtered1.iloc[i]["RcjID"]
  1486. detail = pd.read_csv("de/yl/JD_JiXieK.csv")
  1487. filtered2 = detail[detail["RcjID"]==rcjID]
  1488. if len(filtered2) > 0:
  1489. jxbh = filtered2.iloc[0]["jxbh"]
  1490. jxmc = filtered2.iloc[0]["jxmc"]
  1491. DW = filtered2.iloc[0]["DW"]
  1492. tbdj = filtered2.iloc[0]["tbdj"]
  1493. jxde_["jxbh"] = jxbh
  1494. jxde_["jxmc"] = jxmc
  1495. jxde_["DW"] = DW
  1496. jxde_["tbdj"] = tbdj.item()
  1497. jxde_["sl"] = sl.item()
  1498. jxde_["hj"] = hj.item()
  1499. jxde.append(jxde_)
  1500. ####cailiao
  1501. clde = []
  1502. cl = pd.read_csv("de/yl/JD_GuJiaCL.csv")
  1503. filtered1 = cl[cl["DEBH"]==debh]
  1504. for i in range(len(filtered1)):
  1505. clde_ = {}
  1506. SL = filtered1.iloc[i]["SL"]##shuliang
  1507. HJ = filtered1.iloc[i]["HJ"]##hejia
  1508. rcjID = filtered1.iloc[i]["RcjID"]
  1509. detail = pd.read_csv("de/yl/JD_CaiLiaoK.csv")
  1510. filtered2 = detail[detail["RcjID"]==rcjID]
  1511. if len(filtered2) > 0:
  1512. CLBH = filtered2.iloc[0]["CLBH"]
  1513. CLMC = filtered2.iloc[0]["CLMC"]
  1514. JLDW = filtered2.iloc[0]["JLDW"]
  1515. YSJG = filtered2.iloc[0]["YSJG"]
  1516. clde_["CLBH"] = CLBH
  1517. clde_["CLMC"] = CLMC
  1518. clde_["JLDW"] = JLDW
  1519. clde_["YSJG"] = YSJG.item()
  1520. clde_["SL"] = SL.item()
  1521. clde_["HJ"] = HJ.item()
  1522. clde.append(clde_)
  1523. else:
  1524. detail = pd.read_csv("de/yl/JD_PeiBi.csv")
  1525. filtered2 = detail[detail["RcjID"]==rcjID]
  1526. if len(filtered2) > 0:
  1527. CLBH = filtered2.iloc[0]["PBBH"]
  1528. CLMC = filtered2.iloc[0]["PBMC"]
  1529. JLDW = filtered2.iloc[0]["DW"]
  1530. YSJG = filtered2.iloc[0]["PBDJ"]
  1531. clde_["CLBH"] = CLBH.item()
  1532. clde_["CLMC"] = CLMC
  1533. clde_["JLDW"] = JLDW
  1534. clde_["YSJG"] = YSJG.item()
  1535. clde_["SL"] = SL.item()
  1536. clde_["HJ"] = HJ.item()
  1537. clde.append(clde_)
  1538. 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
  1539. def getSingleDeXilie_az(debh):
  1540. id = None
  1541. bz_selected = []
  1542. bz_selected2 = []
  1543. if "附注" in debh:
  1544. position = debh.find("附注")
  1545. debh = debh[:position]
  1546. if "*" in debh:
  1547. position = debh.find("*")
  1548. debh = debh[:position]
  1549. if debh.endswith("换"):
  1550. debh = debh[:-1]
  1551. if "[" in debh:
  1552. position = debh.find("[")
  1553. debh = debh[:position-1]
  1554. gj = pd.read_csv("de/az/JD_DanWeiGJ.csv")
  1555. filtered = gj[gj["DEBH"]==debh]
  1556. print(filtered)
  1557. if len(filtered) > 0:
  1558. index = (filtered.iloc[0]["YSDELBH"])
  1559. shu = pd.read_csv("de/az/JD_DingEShu.csv")
  1560. hit = shu[shu["zjh"]==index]
  1561. if len(hit) > 0:
  1562. id = hit.iloc[0]["ID"]
  1563. beizhu = str(filtered.iloc[0]["BZBH"])
  1564. if 'nan' in beizhu:
  1565. pass
  1566. else:
  1567. beizhus = beizhu.split(";")
  1568. print(beizhus)
  1569. bzfile = pd.read_csv("de/az/JD_BeiZhuZK.csv")
  1570. bzfile2 = pd.read_csv("de/az/JD_BeiZhuFK.csv", dtype=str)
  1571. bz_selected = bzfile[bzfile["BZBH"].isin(beizhus)]
  1572. bz_selected2 = bzfile2[bzfile2["BZBH"].isin(beizhus)]
  1573. else:
  1574. return None, None, None, None, None, None, None
  1575. ####rengong
  1576. rgde = []
  1577. rg = pd.read_csv("de/az/JD_GuJiaRG.csv")
  1578. filtered1 = rg[rg["DEBH"]==debh]
  1579. for i in range(len(filtered1)):
  1580. rgde_ = {}
  1581. gr = filtered1.iloc[i]["RGR"]##gongri
  1582. gf = filtered1.iloc[i]["RGF"]##gongfei
  1583. rcjID = filtered1.iloc[i]["RcjID"]
  1584. detail = pd.read_csv("de/az/JD_CaiLiaoK.csv")
  1585. filtered2 = detail[detail["RcjID"]==rcjID]
  1586. if len(filtered2) > 0:
  1587. CLBH = filtered2.iloc[0]["CLBH"]
  1588. CLMC = filtered2.iloc[0]["CLMC"]
  1589. JLDW = filtered2.iloc[0]["JLDW"]
  1590. YSJG = filtered2.iloc[0]["YSJG"]
  1591. rgde_["CLBH"] = CLBH
  1592. rgde_["CLMC"] = CLMC
  1593. rgde_["JLDW"] = JLDW
  1594. rgde_["YSJG"] = YSJG
  1595. rgde_["gr"] = gr
  1596. rgde_["gf"] = gf
  1597. rgde.append(rgde_)
  1598. ##print(rgde)
  1599. ####jixie
  1600. jxde = []
  1601. jx = pd.read_csv("de/az/JD_GuJiaJX.csv")
  1602. filtered1 = jx[jx["DEBH"]==debh]
  1603. for i in range(len(filtered1)):
  1604. jxde_ = {}
  1605. sl = filtered1.iloc[i]["SL"]##shuliang
  1606. hj = filtered1.iloc[i]["HJ"]##hejia
  1607. rcjID = filtered1.iloc[i]["RcjID"]
  1608. detail = pd.read_csv("de/az/JD_JiXieK.csv")
  1609. filtered2 = detail[detail["RcjID"]==rcjID]
  1610. if len(filtered2) > 0:
  1611. jxbh = filtered2.iloc[0]["jxbh"]
  1612. jxmc = filtered2.iloc[0]["jxmc"]
  1613. DW = filtered2.iloc[0]["DW"]
  1614. tbdj = filtered2.iloc[0]["tbdj"]
  1615. jxde_["jxbh"] = jxbh
  1616. jxde_["jxmc"] = jxmc
  1617. jxde_["DW"] = DW
  1618. jxde_["tbdj"] = tbdj
  1619. jxde_["sl"] = sl
  1620. jxde_["hj"] = hj
  1621. jxde.append(jxde_)
  1622. ####cailiao
  1623. clde = []
  1624. cl = pd.read_csv("de/az/JD_GuJiaCL.csv")
  1625. filtered1 = cl[cl["DEBH"]==debh]
  1626. for i in range(len(filtered1)):
  1627. clde_ = {}
  1628. SL = filtered1.iloc[i]["SL"]##shuliang
  1629. HJ = filtered1.iloc[i]["HJ"]##hejia
  1630. rcjID = filtered1.iloc[i]["RcjID"]
  1631. detail = pd.read_csv("de/az/JD_CaiLiaoK.csv")
  1632. filtered2 = detail[detail["RcjID"]==rcjID]
  1633. if len(filtered2) > 0:
  1634. CLBH = filtered2.iloc[0]["CLBH"]
  1635. CLMC = filtered2.iloc[0]["CLMC"]
  1636. JLDW = filtered2.iloc[0]["JLDW"]
  1637. YSJG = filtered2.iloc[0]["YSJG"]
  1638. clde_["CLBH"] = CLBH
  1639. clde_["CLMC"] = CLMC
  1640. clde_["JLDW"] = JLDW
  1641. clde_["YSJG"] = YSJG
  1642. clde_["SL"] = SL
  1643. clde_["HJ"] = HJ
  1644. clde.append(clde_)
  1645. else:
  1646. detail = pd.read_csv("de/az/JD_PeiBi.csv")
  1647. filtered2 = detail[detail["RcjID"]==rcjID]
  1648. if len(filtered2) > 0:
  1649. CLBH = filtered2.iloc[0]["PBBH"]
  1650. CLMC = filtered2.iloc[0]["PBMC"]
  1651. JLDW = filtered2.iloc[0]["DW"]
  1652. YSJG = filtered2.iloc[0]["PBDJ"]
  1653. clde_["CLBH"] = CLBH
  1654. clde_["CLMC"] = CLMC
  1655. clde_["JLDW"] = JLDW
  1656. clde_["YSJG"] = YSJG
  1657. clde_["SL"] = SL
  1658. clde_["HJ"] = HJ
  1659. clde.append(clde_)
  1660. 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
  1661. def getSingleDeXilie_sz(debh):
  1662. id = None
  1663. bz_selected = []
  1664. bz_selected2 = []
  1665. if "附注" in debh:
  1666. position = debh.find("附注")
  1667. debh = debh[:position]
  1668. if "*" in debh:
  1669. position = debh.find("*")
  1670. debh = debh[:position]
  1671. if debh.endswith("换"):
  1672. debh = debh[:-1]
  1673. if "[" in debh:
  1674. position = debh.find("[")
  1675. debh = debh[:position-1]
  1676. gj = pd.read_csv("de/sz/JD_DanWeiGJ.csv")
  1677. filtered = gj[gj["DEBH"]==debh]
  1678. print(filtered)
  1679. if len(filtered) > 0:
  1680. index = (filtered.iloc[0]["YSDELBH"])
  1681. shu = pd.read_csv("de/sz/JD_DingEShu.csv")
  1682. hit = shu[shu["zjh"]==index]
  1683. if len(hit) > 0:
  1684. id = hit.iloc[0]["ID"]
  1685. beizhu = str(filtered.iloc[0]["BZBH"])
  1686. if 'nan' in beizhu:
  1687. pass
  1688. else:
  1689. beizhus = beizhu.split(";")
  1690. print(beizhus)
  1691. bzfile = pd.read_csv("de/sz/JD_BeiZhuZK.csv")
  1692. bzfile2 = pd.read_csv("de/sz/JD_BeiZhuFK.csv", dtype=str)
  1693. bz_selected = bzfile[bzfile["BZBH"].isin(beizhus)]
  1694. bz_selected2 = bzfile2[bzfile2["BZBH"].isin(beizhus)]
  1695. else:
  1696. return None, None, None, None, None, None, None
  1697. ####rengong
  1698. rgde = []
  1699. rg = pd.read_csv("de/sz/JD_GuJiaRG.csv")
  1700. filtered1 = rg[rg["DEBH"]==debh]
  1701. for i in range(len(filtered1)):
  1702. rgde_ = {}
  1703. gr = filtered1.iloc[i]["RGR"]##gongri
  1704. gf = filtered1.iloc[i]["RGF"]##gongfei
  1705. rcjID = filtered1.iloc[i]["RcjID"]
  1706. detail = pd.read_csv("de/sz/JD_CaiLiaoK.csv")
  1707. filtered2 = detail[detail["RcjID"]==rcjID]
  1708. if len(filtered2) > 0:
  1709. CLBH = filtered2.iloc[0]["CLBH"]
  1710. CLMC = filtered2.iloc[0]["CLMC"]
  1711. JLDW = filtered2.iloc[0]["JLDW"]
  1712. YSJG = filtered2.iloc[0]["YSJG"]
  1713. rgde_["CLBH"] = CLBH
  1714. rgde_["CLMC"] = CLMC
  1715. rgde_["JLDW"] = JLDW
  1716. rgde_["YSJG"] = YSJG.item() if type(YSJG) == float64 else YSJG
  1717. rgde_["gr"] = gr.item() if type(gr) == float64 else gr
  1718. rgde_["gf"] = gf.item() if type(gf) == float64 else gf
  1719. rgde.append(rgde_)
  1720. ##print(rgde)
  1721. ####jixie
  1722. jxde = []
  1723. jx = pd.read_csv("de/sz/JD_GuJiaJX.csv")
  1724. filtered1 = jx[jx["DEBH"]==debh]
  1725. for i in range(len(filtered1)):
  1726. jxde_ = {}
  1727. sl = filtered1.iloc[i]["SL"]##shuliang
  1728. hj = filtered1.iloc[i]["HJ"]##hejia
  1729. rcjID = filtered1.iloc[i]["RcjID"]
  1730. detail = pd.read_csv("de/sz/JD_JiXieK.csv")
  1731. filtered2 = detail[detail["RcjID"]==rcjID]
  1732. if len(filtered2) > 0:
  1733. jxbh = filtered2.iloc[0]["jxbh"]
  1734. jxmc = filtered2.iloc[0]["jxmc"]
  1735. DW = filtered2.iloc[0]["DW"]
  1736. tbdj = filtered2.iloc[0]["tbdj"]
  1737. jxde_["jxbh"] = jxbh
  1738. jxde_["jxmc"] = jxmc
  1739. jxde_["DW"] = DW
  1740. jxde_["tbdj"] = tbdj.item() if type(tbdj) == float64 else tbdj
  1741. jxde_["sl"] = sl.item() if type(sl) == float64 else sl
  1742. jxde_["hj"] = hj.item() if type(hj) == float64 else hj
  1743. jxde.append(jxde_)
  1744. ####cailiao
  1745. clde = []
  1746. cl = pd.read_csv("de/sz/JD_GuJiaCL.csv")
  1747. filtered1 = cl[cl["DEBH"]==debh]
  1748. for i in range(len(filtered1)):
  1749. clde_ = {}
  1750. SL = filtered1.iloc[i]["SL"]##shuliang
  1751. HJ = filtered1.iloc[i]["HJ"]##hejia
  1752. rcjID = filtered1.iloc[i]["RcjID"]
  1753. detail = pd.read_csv("de/sz/JD_CaiLiaoK.csv")
  1754. filtered2 = detail[detail["RcjID"]==rcjID]
  1755. if len(filtered2) > 0:
  1756. CLBH = filtered2.iloc[0]["CLBH"]
  1757. CLMC = filtered2.iloc[0]["CLMC"]
  1758. JLDW = filtered2.iloc[0]["JLDW"]
  1759. YSJG = filtered2.iloc[0]["YSJG"]
  1760. clde_["CLBH"] = CLBH
  1761. clde_["CLMC"] = CLMC
  1762. clde_["JLDW"] = JLDW
  1763. clde_["YSJG"] = YSJG.item() if type(YSJG) == float64 else YSJG
  1764. clde_["SL"] = SL.item() if type(SL) == float64 else SL
  1765. clde_["HJ"] = HJ.item() if type(HJ) == float64 else HJ
  1766. clde.append(clde_)
  1767. else:
  1768. detail = pd.read_csv("de/sz/JD_PeiBi.csv")
  1769. filtered2 = detail[detail["RcjID"]==rcjID]
  1770. if len(filtered2) > 0:
  1771. CLBH = filtered2.iloc[0]["PBBH"]
  1772. CLMC = filtered2.iloc[0]["PBMC"]
  1773. JLDW = filtered2.iloc[0]["DW"]
  1774. YSJG = filtered2.iloc[0]["PBDJ"]
  1775. clde_["CLBH"] = CLBH
  1776. clde_["CLMC"] = CLMC
  1777. clde_["JLDW"] = JLDW
  1778. clde_["YSJG"] = YSJG.item() if type(YSJG) == float64 else YSJG
  1779. clde_["SL"] = SL.item() if type(SL) == float64 else SL
  1780. clde_["HJ"] = HJ.item() if type(HJ) == float64 else HJ
  1781. clde.append(clde_)
  1782. 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
  1783. def getSingleDeXilie_tj(debh):
  1784. id = None
  1785. bz_selected = []
  1786. bz_selected2 = []
  1787. if "附注" in debh:
  1788. position = debh.find("附注")
  1789. debh = debh[:position]
  1790. if "*" in debh:
  1791. position = debh.find("*")
  1792. debh = debh[:position]
  1793. if debh.endswith("换"):
  1794. debh = debh[:-1]
  1795. if "[" in debh:
  1796. position = debh.find("[")
  1797. debh = debh[:position-1]
  1798. gj = pd.read_csv("de/tj/JD_DanWeiGJ.csv")
  1799. filtered = gj[gj["DEBH"]==debh]
  1800. print(filtered)
  1801. if len(filtered) > 0:
  1802. index = int(filtered.iloc[0]["YSDELBH"])
  1803. shu = pd.read_csv("de/tj/JD_DingEShu.csv")
  1804. hit = shu[shu["zjh"]==index]
  1805. if len(hit) > 0:
  1806. id = hit.iloc[0]["ID"]
  1807. beizhu = str(filtered.iloc[0]["BZBH"])
  1808. if 'nan' in beizhu:
  1809. pass
  1810. else:
  1811. beizhus = beizhu.split(";")
  1812. print(beizhus)
  1813. bzfile = pd.read_csv("de/tj/JD_BeiZhuZK.csv")
  1814. bzfile2 = pd.read_csv("de/tj/JD_BeiZhuFK.csv", dtype=str)
  1815. bz_selected = bzfile[bzfile["BZBH"].isin(beizhus)]
  1816. bz_selected2 = bzfile2[bzfile2["BZBH"].isin(beizhus)]
  1817. else:
  1818. return None, None, None, None, None, None, None
  1819. ####rengong
  1820. rgde = []
  1821. rg = pd.read_csv("de/tj/JD_GuJiaRG.csv")
  1822. filtered1 = rg[rg["DEBH"]==debh]
  1823. for i in range(len(filtered1)):
  1824. rgde_ = {}
  1825. gr = filtered1.iloc[i]["RGR"]##gongri
  1826. gf = filtered1.iloc[i]["RGF"]##gongfei
  1827. rcjID = filtered1.iloc[i]["RcjID"]
  1828. detail = pd.read_csv("de/tj/JD_CaiLiaoK.csv")
  1829. filtered2 = detail[detail["RcjID"]==rcjID]
  1830. if len(filtered2) > 0:
  1831. CLBH = filtered2.iloc[0]["CLBH"]
  1832. CLMC = filtered2.iloc[0]["CLMC"]
  1833. JLDW = filtered2.iloc[0]["JLDW"]
  1834. YSJG = filtered2.iloc[0]["YSJG"]
  1835. rgde_["CLBH"] = CLBH
  1836. rgde_["CLMC"] = CLMC
  1837. rgde_["JLDW"] = JLDW
  1838. rgde_["YSJG"] = YSJG.item() if type(YSJG) == float64 else YSJG
  1839. rgde_["gr"] = gr.item() if type(gr) == float64 else gr
  1840. rgde_["gf"] = gf.item() if type(gf) == float64 else gf
  1841. rgde.append(rgde_)
  1842. ##print(rgde)
  1843. ####jixie
  1844. jxde = []
  1845. jx = pd.read_csv("de/tj/JD_GuJiaJX.csv")
  1846. filtered1 = jx[jx["DEBH"]==debh]
  1847. for i in range(len(filtered1)):
  1848. jxde_ = {}
  1849. sl = filtered1.iloc[i]["SL"]##shuliang
  1850. hj = filtered1.iloc[i]["HJ"]##hejia
  1851. rcjID = filtered1.iloc[i]["RcjID"]
  1852. detail = pd.read_csv("de/tj/JD_JiXieK.csv")
  1853. filtered2 = detail[detail["RcjID"]==rcjID]
  1854. if len(filtered2) > 0:
  1855. jxbh = filtered2.iloc[0]["jxbh"]
  1856. jxmc = filtered2.iloc[0]["jxmc"]
  1857. DW = filtered2.iloc[0]["DW"]
  1858. tbdj = filtered2.iloc[0]["tbdj"]
  1859. jxde_["jxbh"] = jxbh
  1860. jxde_["jxmc"] = jxmc
  1861. jxde_["DW"] = DW
  1862. jxde_["tbdj"] = tbdj.item() if type(tbdj) == float64 else tbdj
  1863. jxde_["sl"] = sl.item() if type(sl) == float64 else sl
  1864. jxde_["hj"] = hj.item() if type(hj) == float64 else hj
  1865. jxde.append(jxde_)
  1866. ####cailiao
  1867. clde = []
  1868. cl = pd.read_csv("de/tj/JD_GuJiaCL.csv")
  1869. filtered1 = cl[cl["DEBH"]==debh]
  1870. for i in range(len(filtered1)):
  1871. clde_ = {}
  1872. SL = filtered1.iloc[i]["SL"]##shuliang
  1873. HJ = filtered1.iloc[i]["HJ"]##hejia
  1874. rcjID = filtered1.iloc[i]["RcjID"]
  1875. detail = pd.read_csv("de/tj/JD_CaiLiaoK.csv")
  1876. filtered2 = detail[detail["RcjID"]==rcjID]
  1877. if len(filtered2) > 0:
  1878. CLBH = filtered2.iloc[0]["CLBH"]
  1879. CLMC = filtered2.iloc[0]["CLMC"]
  1880. JLDW = filtered2.iloc[0]["JLDW"]
  1881. YSJG = filtered2.iloc[0]["YSJG"]
  1882. clde_["CLBH"] = CLBH
  1883. clde_["CLMC"] = CLMC
  1884. clde_["JLDW"] = JLDW
  1885. clde_["YSJG"] = YSJG.item() if type(YSJG) == float64 else YSJG
  1886. clde_["SL"] = SL.item() if type(SL) == float64 else SL
  1887. clde_["HJ"] = HJ.item() if type(HJ) == float64 else HJ
  1888. clde.append(clde_)
  1889. else:
  1890. detail = pd.read_csv("de/tj/JD_PeiBi.csv")
  1891. filtered2 = detail[detail["RcjID"]==rcjID]
  1892. if len(filtered2) > 0:
  1893. CLBH = filtered2.iloc[0]["PBBH"]
  1894. CLMC = filtered2.iloc[0]["PBMC"]
  1895. JLDW = filtered2.iloc[0]["DW"]
  1896. YSJG = filtered2.iloc[0]["PBDJ"]
  1897. clde_["CLBH"] = CLBH
  1898. clde_["CLMC"] = CLMC
  1899. clde_["JLDW"] = JLDW
  1900. clde_["YSJG"] = YSJG.item() if type(YSJG) == float64 else YSJG
  1901. clde_["SL"] = SL.item() if type(SL) == float64 else SL
  1902. clde_["HJ"] = HJ.item() if type(HJ) == float64 else HJ
  1903. clde.append(clde_)
  1904. 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
  1905. def getDwgc(root, id, Zylb):
  1906. result = []
  1907. #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
  1908. item = None
  1909. for child in root:
  1910. if child.tag == "Dxgcxx":
  1911. for child1 in child:
  1912. Dwgcbh = child1.attrib["Dwgcbh"]
  1913. if Dwgcbh == id:
  1914. item = child1
  1915. break
  1916. ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
  1917. id = id + "Zylb" + Zylb
  1918. for child in item:
  1919. if child.tag == "Fywj":
  1920. result.append({"id": id + "bao jia hui zong", "label": "报价汇总表"})
  1921. elif child.tag == "Gfsj":
  1922. result.append({"id": id + "gui fei shui jin", "label": "规费税金"})
  1923. elif child.tag == "Qdxm":
  1924. result.append({"id": id + "qing dan xiang mu", "label": "清单项目"})
  1925. elif child.tag == "Csxm":
  1926. result.append({"id": id + "cuo shi xiang mu", "label": "措施项目"})
  1927. elif child.tag == "Qtxm":
  1928. result.append({"id": id +"qi ta xiang mu", "label": "其他项目"})
  1929. elif child.tag == "Zlje":
  1930. result.append({"id": id +"zan lie jin e", "label": "暂列金额"})
  1931. elif child.tag == "Clzg":
  1932. result.append({"id": id +"cai liao zan gu jia", "label": "材料暂估价"})
  1933. elif child.tag == "Zygczg":
  1934. result.append({"id": id + "zhuan ye gong cheng zan gu jia", "label": "专业工程暂估价"})
  1935. elif child.tag == "Jrg":
  1936. result.append({"id": id + "ji ri gong", "label": "计日工"})
  1937. elif child.tag == "Zcbfwf":
  1938. result.append({"id": id + "zong cheng bao fu wu fei", "label": "总承包服务费"})
  1939. elif child.tag == "Zjxmjdkzffj":
  1940. result.append({"id": id + "zong jia xiang mu jin du kuan zhi fu fen jie", "label": "总价项目进度款支付分解"})
  1941. elif child.tag == "Fbrgycl":
  1942. result.append({"id": id + "fa bao ren gong ying cai liao", "label": "发包人供应材料"})
  1943. elif child.tag == "Cbrgycl":
  1944. result.append({"id": id + "cheng bao ren gong ying cai liao", "label": "承包人供应材料"})
  1945. elif child.tag == "Rcjhz":
  1946. result.append({"id": id + "ren cai ji hui zong", "label": "人材机汇总"})
  1947. else:
  1948. print(child.tag)
  1949. print("WARNING####################################################################")
  1950. return result