service.py 80 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060
  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": "None",
  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. def getDeXilie(value, id):
  1017. print(type(id))
  1018. if value == 10:
  1019. shu = pd.read_csv("de/tj/JD_DingEShu.csv")
  1020. elif value == 20:
  1021. shu = pd.read_csv("de/sz/JD_DingEShu.csv")
  1022. elif value == 30:
  1023. shu = pd.read_csv("de/az/JD_DingEShu.csv")
  1024. elif value == 40:
  1025. shu = pd.read_csv("de/yl/JD_DingEShu.csv")
  1026. elif value == 50:
  1027. shu = pd.read_csv("de/xstj/JD_DingEShu.csv")
  1028. else:
  1029. shu = pd.read_csv("de/xsaz/JD_DingEShu.csv")
  1030. hit = shu[shu["ID"]==int(id)]
  1031. print(hit)
  1032. if len(hit) == 0:
  1033. return []
  1034. hit0 = hit.iloc[0]
  1035. index = str(hit0['zjh'])
  1036. print("index=" + index)
  1037. if value == 10:
  1038. gj = pd.read_csv("de/tj/JD_DanWeiGJ.csv")
  1039. filtered = gj[gj["YSDELBH"]==int(index)]
  1040. elif value == 20:
  1041. gj = pd.read_csv("de/sz/JD_DanWeiGJ.csv")
  1042. filtered = gj[gj["YSDELBH"]==(index)]
  1043. elif value == 30:
  1044. gj = pd.read_csv("de/az/JD_DanWeiGJ.csv")
  1045. filtered = gj[gj["YSDELBH"]==(index)]
  1046. elif value == 40:
  1047. gj = pd.read_csv("de/yl/JD_DanWeiGJ.csv")
  1048. filtered = gj[gj["YSDELBH"]==int(index)]
  1049. elif value == 50:
  1050. gj = pd.read_csv("de/xstj/JD_DanWeiGJ.csv")
  1051. filtered = gj[gj["YSDELBH"]==int(index)]
  1052. else:
  1053. gj = pd.read_csv("de/xsaz/JD_DanWeiGJ.csv")
  1054. filtered = gj[gj["YSDELBH"]==int(index)]
  1055. return filtered.to_json(force_ascii=False)
  1056. def getQufei(name):
  1057. if name == "0":
  1058. gj = pd.read_csv("de/tj/JD_PeiBi.csv")
  1059. return gj.to_json(force_ascii=False)
  1060. shu = pd.read_csv("de/tj/JD_PeiBiFLB.csv")
  1061. hit = shu[shu["ID"]==int(name)]
  1062. print(hit)
  1063. if len(hit) == 0:
  1064. return []
  1065. hit0 = hit.iloc[0]
  1066. index = str(hit0['pblbh'])
  1067. index_list = index.split(";")
  1068. gj = pd.read_csv("de/tj/JD_PeiBi.csv")
  1069. filtered = gj[gj["PBBH"].str.startswith(tuple(index_list))]
  1070. return filtered.to_json(force_ascii=False)
  1071. def getPbxl(name):
  1072. if name == "0":
  1073. gj = pd.read_csv("de/tj/JD_PeiBi.csv")
  1074. return gj.to_json(force_ascii=False)
  1075. shu = pd.read_csv("de/tj/JD_PeiBiFLB.csv")
  1076. hit = shu[shu["ID"]==int(name)]
  1077. print(hit)
  1078. if len(hit) == 0:
  1079. return []
  1080. hit0 = hit.iloc[0]
  1081. index = str(hit0['pblbh'])
  1082. index_list = index.split(";")
  1083. gj = pd.read_csv("de/tj/JD_PeiBi.csv")
  1084. filtered = gj[gj["PBBH"].str.startswith(tuple(index_list))]
  1085. return filtered.to_json(force_ascii=False)
  1086. def getSingleDeXilie(zhuanye, debh):
  1087. if zhuanye == 10:
  1088. A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_tj(debh)
  1089. if A1:
  1090. return A1, A2, A3, A4, A5, A6, A7, 10
  1091. else:
  1092. A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_sz(debh)
  1093. return A1, A2, A3, A4,A5, A6, A7, 20
  1094. elif zhuanye == 20:##shizheng
  1095. A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_sz(debh)
  1096. if A1:
  1097. return A1, A2, A3, A4, A5, A6, A7, 20
  1098. else:
  1099. A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_tj(debh)
  1100. if A1:
  1101. return A1, A2, A3, A4, A5, A6, A7, 10
  1102. else:
  1103. A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_az(debh)
  1104. return A1, A2, A3, A4, A5, A6, A7, 30
  1105. elif zhuanye == 30:##anzhuang
  1106. A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_az(debh)
  1107. return A1, A2, A3, A4, A5, A6, A7, 30
  1108. elif zhuanye == 40:##yuanlin
  1109. A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_yl(debh)
  1110. return A1, A2, A3, A4, A5, A6, A7, 40
  1111. elif zhuanye == 50: ## xiushan tujian
  1112. A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_xstj(debh)
  1113. if A1:
  1114. return A1, A2, A3, A4, A5, A6, A7, 50
  1115. else:
  1116. A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_tj(debh)
  1117. return A1, A2, A3, A4,A5, A6, A7, 10
  1118. else:
  1119. A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_xsaz(debh)
  1120. if A1:
  1121. return A1, A2, A3, A4, A5, A6, A7, 60
  1122. else:
  1123. A1, A2, A3, A4, A5, A6, A7 = getSingleDeXilie_az(debh)
  1124. return A1, A2, A3, A4,A5, A6, A7, 30
  1125. def getSingleDeXilie_xsaz(debh):
  1126. id = None
  1127. bz_selected = []
  1128. bz_selected2 = []
  1129. if "附注" in debh:
  1130. position = debh.find("附注")
  1131. debh = debh[:position]
  1132. if "*" in debh:
  1133. position = debh.find("*")
  1134. debh = debh[:position]
  1135. if debh.endswith("换"):
  1136. debh = debh[:-1]
  1137. if "[" in debh:
  1138. position = debh.find("[")
  1139. debh = debh[:position-1]
  1140. gj = pd.read_csv("de/xsaz/JD_DanWeiGJ.csv")
  1141. filtered = gj[gj["DEBH"]==debh]
  1142. print(filtered)
  1143. if len(filtered) > 0:
  1144. index = (filtered.iloc[0]["YSDELBH"])
  1145. shu = pd.read_csv("de/xsaz/JD_DingEShu.csv")
  1146. hit = shu[shu["zjh"]==index]
  1147. if len(hit) > 0:
  1148. id = hit.iloc[0]["ID"]
  1149. beizhu = str(filtered.iloc[0]["BZBH"])
  1150. if 'nan' in beizhu:
  1151. pass
  1152. else:
  1153. beizhus = beizhu.split(";")
  1154. print(beizhus)
  1155. bzfile = pd.read_csv("de/xsaz/JD_BeiZhuZK.csv")
  1156. bzfile2 = pd.read_csv("de/xsaz/JD_BeiZhuFK.csv", dtype=str)
  1157. bz_selected = bzfile[bzfile["BZBH"].isin(beizhus)]
  1158. bz_selected2 = bzfile2[bzfile2["BZBH"].isin(beizhus)]
  1159. else:
  1160. return None, None, None, None, None, None, None
  1161. ####rengong
  1162. rgde = []
  1163. rg = pd.read_csv("de/xsaz/JD_GuJiaRG.csv")
  1164. filtered1 = rg[rg["DEBH"]==debh]
  1165. for i in range(len(filtered1)):
  1166. rgde_ = {}
  1167. gr = filtered1.iloc[i]["RGR"]##gongri
  1168. gf = filtered1.iloc[i]["RGF"]##gongfei
  1169. rcjID = filtered1.iloc[i]["RcjID"]
  1170. detail = pd.read_csv("de/xsaz/JD_CaiLiaoK.csv")
  1171. filtered2 = detail[detail["RcjID"]==rcjID]
  1172. if len(filtered2) > 0:
  1173. CLBH = filtered2.iloc[0]["CLBH"]
  1174. CLMC = filtered2.iloc[0]["CLMC"]
  1175. JLDW = filtered2.iloc[0]["JLDW"]
  1176. YSJG = filtered2.iloc[0]["YSJG"]
  1177. rgde_["CLBH"] = CLBH
  1178. rgde_["CLMC"] = CLMC
  1179. rgde_["JLDW"] = JLDW
  1180. rgde_["YSJG"] = YSJG.item()
  1181. rgde_["gr"] = gr.item()
  1182. rgde_["gf"] = gf.item()
  1183. rgde.append(rgde_)
  1184. ##print(rgde)
  1185. ####jixie
  1186. jxde = []
  1187. jx = pd.read_csv("de/xsaz/JD_GuJiaJX.csv")
  1188. filtered1 = jx[jx["DEBH"]==debh]
  1189. for i in range(len(filtered1)):
  1190. jxde_ = {}
  1191. sl = filtered1.iloc[i]["SL"]##shuliang
  1192. hj = filtered1.iloc[i]["HJ"]##hejia
  1193. rcjID = filtered1.iloc[i]["RcjID"]
  1194. detail = pd.read_csv("de/xsaz/JD_JiXieK.csv")
  1195. filtered2 = detail[detail["RcjID"]==rcjID]
  1196. if len(filtered2) > 0:
  1197. jxbh = filtered2.iloc[0]["jxbh"]
  1198. jxmc = filtered2.iloc[0]["jxmc"]
  1199. DW = filtered2.iloc[0]["DW"]
  1200. tbdj = filtered2.iloc[0]["tbdj"]
  1201. jxde_["jxbh"] = jxbh
  1202. jxde_["jxmc"] = jxmc
  1203. jxde_["DW"] = DW
  1204. jxde_["tbdj"] = tbdj.item()
  1205. jxde_["sl"] = sl.item()
  1206. jxde_["hj"] = hj.item()
  1207. jxde.append(jxde_)
  1208. ####cailiao
  1209. clde = []
  1210. cl = pd.read_csv("de/xsaz/JD_GuJiaCL.csv")
  1211. filtered1 = cl[cl["DEBH"]==debh]
  1212. for i in range(len(filtered1)):
  1213. clde_ = {}
  1214. SL = filtered1.iloc[i]["SL"]##shuliang
  1215. HJ = filtered1.iloc[i]["HJ"]##hejia
  1216. rcjID = filtered1.iloc[i]["RcjID"]
  1217. detail = pd.read_csv("de/xsaz/JD_CaiLiaoK.csv")
  1218. filtered2 = detail[detail["RcjID"]==rcjID]
  1219. if len(filtered2) > 0:
  1220. CLBH = filtered2.iloc[0]["CLBH"]
  1221. CLMC = filtered2.iloc[0]["CLMC"]
  1222. JLDW = filtered2.iloc[0]["JLDW"]
  1223. YSJG = filtered2.iloc[0]["YSJG"]
  1224. clde_["CLBH"] = CLBH
  1225. clde_["CLMC"] = CLMC
  1226. clde_["JLDW"] = JLDW
  1227. clde_["YSJG"] = YSJG.item()
  1228. clde_["SL"] = SL.item()
  1229. clde_["HJ"] = HJ.item()
  1230. clde.append(clde_)
  1231. else:
  1232. detail = pd.read_csv("de/xsaz/JD_PeiBi.csv")
  1233. filtered2 = detail[detail["RcjID"]==rcjID]
  1234. if len(filtered2) > 0:
  1235. CLBH = filtered2.iloc[0]["PBBH"]
  1236. CLMC = filtered2.iloc[0]["PBMC"]
  1237. JLDW = filtered2.iloc[0]["DW"]
  1238. YSJG = filtered2.iloc[0]["PBDJ"]
  1239. clde_["CLBH"] = CLBH.item()
  1240. clde_["CLMC"] = CLMC
  1241. clde_["JLDW"] = JLDW
  1242. clde_["YSJG"] = YSJG.item()
  1243. clde_["SL"] = SL.item()
  1244. clde_["HJ"] = HJ.item()
  1245. clde.append(clde_)
  1246. 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
  1247. def getSingleDeXilie_xstj(debh):
  1248. id = None
  1249. bz_selected = []
  1250. bz_selected2 = []
  1251. if "附注" in debh:
  1252. position = debh.find("附注")
  1253. debh = debh[:position]
  1254. if "*" in debh:
  1255. position = debh.find("*")
  1256. debh = debh[:position]
  1257. if debh.endswith("换"):
  1258. debh = debh[:-1]
  1259. if "[" in debh:
  1260. position = debh.find("[")
  1261. debh = debh[:position-1]
  1262. gj = pd.read_csv("de/xstj/JD_DanWeiGJ.csv")
  1263. filtered = gj[gj["DEBH"]==debh]
  1264. print(filtered)
  1265. if len(filtered) > 0:
  1266. index = (filtered.iloc[0]["YSDELBH"])
  1267. shu = pd.read_csv("de/xstj/JD_DingEShu.csv")
  1268. hit = shu[shu["zjh"]==index]
  1269. if len(hit) > 0:
  1270. id = hit.iloc[0]["ID"]
  1271. beizhu = str(filtered.iloc[0]["BZBH"])
  1272. if 'nan' in beizhu:
  1273. pass
  1274. else:
  1275. beizhus = beizhu.split(";")
  1276. print(beizhus)
  1277. bzfile = pd.read_csv("de/xstj/JD_BeiZhuZK.csv")
  1278. bzfile2 = pd.read_csv("de/xstj/JD_BeiZhuFK.csv", dtype=str)
  1279. bz_selected = bzfile[bzfile["BZBH"].isin(beizhus)]
  1280. bz_selected2 = bzfile2[bzfile2["BZBH"].isin(beizhus)]
  1281. else:
  1282. return None, None, None, None, None, None, None
  1283. ####rengong
  1284. rgde = []
  1285. rg = pd.read_csv("de/xstj/JD_GuJiaRG.csv")
  1286. filtered1 = rg[rg["DEBH"]==debh]
  1287. for i in range(len(filtered1)):
  1288. rgde_ = {}
  1289. gr = filtered1.iloc[i]["RGR"]##gongri
  1290. gf = filtered1.iloc[i]["RGF"]##gongfei
  1291. rcjID = filtered1.iloc[i]["RcjID"]
  1292. detail = pd.read_csv("de/xstj/JD_CaiLiaoK.csv")
  1293. filtered2 = detail[detail["RcjID"]==rcjID]
  1294. if len(filtered2) > 0:
  1295. CLBH = filtered2.iloc[0]["CLBH"]
  1296. CLMC = filtered2.iloc[0]["CLMC"]
  1297. JLDW = filtered2.iloc[0]["JLDW"]
  1298. YSJG = filtered2.iloc[0]["YSJG"]
  1299. rgde_["CLBH"] = CLBH
  1300. rgde_["CLMC"] = CLMC
  1301. rgde_["JLDW"] = JLDW
  1302. rgde_["YSJG"] = YSJG.item()
  1303. rgde_["gr"] = gr.item()
  1304. rgde_["gf"] = gf.item()
  1305. rgde.append(rgde_)
  1306. ##print(rgde)
  1307. ####jixie
  1308. jxde = []
  1309. jx = pd.read_csv("de/xstj/JD_GuJiaJX.csv")
  1310. filtered1 = jx[jx["DEBH"]==debh]
  1311. for i in range(len(filtered1)):
  1312. jxde_ = {}
  1313. sl = filtered1.iloc[i]["SL"]##shuliang
  1314. hj = filtered1.iloc[i]["HJ"]##hejia
  1315. rcjID = filtered1.iloc[i]["RcjID"]
  1316. detail = pd.read_csv("de/xstj/JD_JiXieK.csv")
  1317. filtered2 = detail[detail["RcjID"]==rcjID]
  1318. if len(filtered2) > 0:
  1319. jxbh = filtered2.iloc[0]["jxbh"]
  1320. jxmc = filtered2.iloc[0]["jxmc"]
  1321. DW = filtered2.iloc[0]["DW"]
  1322. tbdj = filtered2.iloc[0]["tbdj"]
  1323. jxde_["jxbh"] = jxbh
  1324. jxde_["jxmc"] = jxmc
  1325. jxde_["DW"] = DW
  1326. jxde_["tbdj"] = tbdj.item()
  1327. jxde_["sl"] = sl.item()
  1328. jxde_["hj"] = hj.item()
  1329. jxde.append(jxde_)
  1330. ####cailiao
  1331. clde = []
  1332. cl = pd.read_csv("de/xstj/JD_GuJiaCL.csv")
  1333. filtered1 = cl[cl["DEBH"]==debh]
  1334. for i in range(len(filtered1)):
  1335. clde_ = {}
  1336. SL = filtered1.iloc[i]["SL"]##shuliang
  1337. HJ = filtered1.iloc[i]["HJ"]##hejia
  1338. rcjID = filtered1.iloc[i]["RcjID"]
  1339. detail = pd.read_csv("de/xstj/JD_CaiLiaoK.csv")
  1340. filtered2 = detail[detail["RcjID"]==rcjID]
  1341. if len(filtered2) > 0:
  1342. CLBH = filtered2.iloc[0]["CLBH"]
  1343. CLMC = filtered2.iloc[0]["CLMC"]
  1344. JLDW = filtered2.iloc[0]["JLDW"]
  1345. YSJG = filtered2.iloc[0]["YSJG"]
  1346. clde_["CLBH"] = CLBH
  1347. clde_["CLMC"] = CLMC
  1348. clde_["JLDW"] = JLDW
  1349. clde_["YSJG"] = YSJG.item()
  1350. clde_["SL"] = SL.item()
  1351. clde_["HJ"] = HJ.item()
  1352. clde.append(clde_)
  1353. else:
  1354. detail = pd.read_csv("de/xstj/JD_PeiBi.csv")
  1355. filtered2 = detail[detail["RcjID"]==rcjID]
  1356. if len(filtered2) > 0:
  1357. CLBH = filtered2.iloc[0]["PBBH"]
  1358. CLMC = filtered2.iloc[0]["PBMC"]
  1359. JLDW = filtered2.iloc[0]["DW"]
  1360. YSJG = filtered2.iloc[0]["PBDJ"]
  1361. clde_["CLBH"] = CLBH.item()
  1362. clde_["CLMC"] = CLMC
  1363. clde_["JLDW"] = JLDW
  1364. clde_["YSJG"] = YSJG.item()
  1365. clde_["SL"] = SL.item()
  1366. clde_["HJ"] = HJ.item()
  1367. clde.append(clde_)
  1368. 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
  1369. def getSingleDeXilie_yl(debh):
  1370. id = None
  1371. bz_selected = []
  1372. bz_selected2 = []
  1373. if "附注" in debh:
  1374. position = debh.find("附注")
  1375. debh = debh[:position]
  1376. if "*" in debh:
  1377. position = debh.find("*")
  1378. debh = debh[:position]
  1379. if debh.endswith("换"):
  1380. debh = debh[:-1]
  1381. if "[" in debh:
  1382. position = debh.find("[")
  1383. debh = debh[:position-1]
  1384. gj = pd.read_csv("de/yl/JD_DanWeiGJ.csv")
  1385. filtered = gj[gj["DEBH"]==debh]
  1386. print(filtered)
  1387. if len(filtered) > 0:
  1388. index = (filtered.iloc[0]["YSDELBH"])
  1389. shu = pd.read_csv("de/yl/JD_DingEShu.csv")
  1390. hit = shu[shu["zjh"]==index]
  1391. if len(hit) > 0:
  1392. id = hit.iloc[0]["ID"]
  1393. beizhu = str(filtered.iloc[0]["BZBH"])
  1394. if 'nan' in beizhu:
  1395. pass
  1396. else:
  1397. beizhus = beizhu.split(";")
  1398. print(beizhus)
  1399. bzfile = pd.read_csv("de/yl/JD_BeiZhuZK.csv")
  1400. bzfile2 = pd.read_csv("de/yl/JD_BeiZhuFK.csv", dtype=str)
  1401. bz_selected = bzfile[bzfile["BZBH"].isin(beizhus)]
  1402. bz_selected2 = bzfile2[bzfile2["BZBH"].isin(beizhus)]
  1403. else:
  1404. return None, None, None, None, None, None, None
  1405. ####rengong
  1406. rgde = []
  1407. rg = pd.read_csv("de/yl/JD_GuJiaRG.csv")
  1408. filtered1 = rg[rg["DEBH"]==debh]
  1409. for i in range(len(filtered1)):
  1410. rgde_ = {}
  1411. gr = filtered1.iloc[i]["RGR"]##gongri
  1412. gf = filtered1.iloc[i]["RGF"]##gongfei
  1413. rcjID = filtered1.iloc[i]["RcjID"]
  1414. detail = pd.read_csv("de/yl/JD_CaiLiaoK.csv")
  1415. filtered2 = detail[detail["RcjID"]==rcjID]
  1416. if len(filtered2) > 0:
  1417. CLBH = filtered2.iloc[0]["CLBH"]
  1418. CLMC = filtered2.iloc[0]["CLMC"]
  1419. JLDW = filtered2.iloc[0]["JLDW"]
  1420. YSJG = filtered2.iloc[0]["YSJG"]
  1421. rgde_["CLBH"] = CLBH
  1422. rgde_["CLMC"] = CLMC
  1423. rgde_["JLDW"] = JLDW
  1424. rgde_["YSJG"] = YSJG.item()
  1425. rgde_["gr"] = gr.item()
  1426. rgde_["gf"] = gf.item()
  1427. rgde.append(rgde_)
  1428. ##print(rgde)
  1429. ####jixie
  1430. jxde = []
  1431. jx = pd.read_csv("de/yl/JD_GuJiaJX.csv")
  1432. filtered1 = jx[jx["DEBH"]==debh]
  1433. for i in range(len(filtered1)):
  1434. jxde_ = {}
  1435. sl = filtered1.iloc[i]["SL"]##shuliang
  1436. hj = filtered1.iloc[i]["HJ"]##hejia
  1437. rcjID = filtered1.iloc[i]["RcjID"]
  1438. detail = pd.read_csv("de/yl/JD_JiXieK.csv")
  1439. filtered2 = detail[detail["RcjID"]==rcjID]
  1440. if len(filtered2) > 0:
  1441. jxbh = filtered2.iloc[0]["jxbh"]
  1442. jxmc = filtered2.iloc[0]["jxmc"]
  1443. DW = filtered2.iloc[0]["DW"]
  1444. tbdj = filtered2.iloc[0]["tbdj"]
  1445. jxde_["jxbh"] = jxbh
  1446. jxde_["jxmc"] = jxmc
  1447. jxde_["DW"] = DW
  1448. jxde_["tbdj"] = tbdj.item()
  1449. jxde_["sl"] = sl.item()
  1450. jxde_["hj"] = hj.item()
  1451. jxde.append(jxde_)
  1452. ####cailiao
  1453. clde = []
  1454. cl = pd.read_csv("de/yl/JD_GuJiaCL.csv")
  1455. filtered1 = cl[cl["DEBH"]==debh]
  1456. for i in range(len(filtered1)):
  1457. clde_ = {}
  1458. SL = filtered1.iloc[i]["SL"]##shuliang
  1459. HJ = filtered1.iloc[i]["HJ"]##hejia
  1460. rcjID = filtered1.iloc[i]["RcjID"]
  1461. detail = pd.read_csv("de/yl/JD_CaiLiaoK.csv")
  1462. filtered2 = detail[detail["RcjID"]==rcjID]
  1463. if len(filtered2) > 0:
  1464. CLBH = filtered2.iloc[0]["CLBH"]
  1465. CLMC = filtered2.iloc[0]["CLMC"]
  1466. JLDW = filtered2.iloc[0]["JLDW"]
  1467. YSJG = filtered2.iloc[0]["YSJG"]
  1468. clde_["CLBH"] = CLBH
  1469. clde_["CLMC"] = CLMC
  1470. clde_["JLDW"] = JLDW
  1471. clde_["YSJG"] = YSJG.item()
  1472. clde_["SL"] = SL.item()
  1473. clde_["HJ"] = HJ.item()
  1474. clde.append(clde_)
  1475. else:
  1476. detail = pd.read_csv("de/yl/JD_PeiBi.csv")
  1477. filtered2 = detail[detail["RcjID"]==rcjID]
  1478. if len(filtered2) > 0:
  1479. CLBH = filtered2.iloc[0]["PBBH"]
  1480. CLMC = filtered2.iloc[0]["PBMC"]
  1481. JLDW = filtered2.iloc[0]["DW"]
  1482. YSJG = filtered2.iloc[0]["PBDJ"]
  1483. clde_["CLBH"] = CLBH.item()
  1484. clde_["CLMC"] = CLMC
  1485. clde_["JLDW"] = JLDW
  1486. clde_["YSJG"] = YSJG.item()
  1487. clde_["SL"] = SL.item()
  1488. clde_["HJ"] = HJ.item()
  1489. clde.append(clde_)
  1490. 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
  1491. def getSingleDeXilie_az(debh):
  1492. id = None
  1493. bz_selected = []
  1494. bz_selected2 = []
  1495. if "附注" in debh:
  1496. position = debh.find("附注")
  1497. debh = debh[:position]
  1498. if "*" in debh:
  1499. position = debh.find("*")
  1500. debh = debh[:position]
  1501. if debh.endswith("换"):
  1502. debh = debh[:-1]
  1503. if "[" in debh:
  1504. position = debh.find("[")
  1505. debh = debh[:position-1]
  1506. gj = pd.read_csv("de/az/JD_DanWeiGJ.csv")
  1507. filtered = gj[gj["DEBH"]==debh]
  1508. print(filtered)
  1509. if len(filtered) > 0:
  1510. index = (filtered.iloc[0]["YSDELBH"])
  1511. shu = pd.read_csv("de/az/JD_DingEShu.csv")
  1512. hit = shu[shu["zjh"]==index]
  1513. if len(hit) > 0:
  1514. id = hit.iloc[0]["ID"]
  1515. beizhu = str(filtered.iloc[0]["BZBH"])
  1516. if 'nan' in beizhu:
  1517. pass
  1518. else:
  1519. beizhus = beizhu.split(";")
  1520. print(beizhus)
  1521. bzfile = pd.read_csv("de/az/JD_BeiZhuZK.csv")
  1522. bzfile2 = pd.read_csv("de/az/JD_BeiZhuFK.csv", dtype=str)
  1523. bz_selected = bzfile[bzfile["BZBH"].isin(beizhus)]
  1524. bz_selected2 = bzfile2[bzfile2["BZBH"].isin(beizhus)]
  1525. else:
  1526. return None, None, None, None, None, None, None
  1527. ####rengong
  1528. rgde = []
  1529. rg = pd.read_csv("de/az/JD_GuJiaRG.csv")
  1530. filtered1 = rg[rg["DEBH"]==debh]
  1531. for i in range(len(filtered1)):
  1532. rgde_ = {}
  1533. gr = filtered1.iloc[i]["RGR"]##gongri
  1534. gf = filtered1.iloc[i]["RGF"]##gongfei
  1535. rcjID = filtered1.iloc[i]["RcjID"]
  1536. detail = pd.read_csv("de/az/JD_CaiLiaoK.csv")
  1537. filtered2 = detail[detail["RcjID"]==rcjID]
  1538. if len(filtered2) > 0:
  1539. CLBH = filtered2.iloc[0]["CLBH"]
  1540. CLMC = filtered2.iloc[0]["CLMC"]
  1541. JLDW = filtered2.iloc[0]["JLDW"]
  1542. YSJG = filtered2.iloc[0]["YSJG"]
  1543. rgde_["CLBH"] = CLBH
  1544. rgde_["CLMC"] = CLMC
  1545. rgde_["JLDW"] = JLDW
  1546. rgde_["YSJG"] = YSJG
  1547. rgde_["gr"] = gr
  1548. rgde_["gf"] = gf
  1549. rgde.append(rgde_)
  1550. ##print(rgde)
  1551. ####jixie
  1552. jxde = []
  1553. jx = pd.read_csv("de/az/JD_GuJiaJX.csv")
  1554. filtered1 = jx[jx["DEBH"]==debh]
  1555. for i in range(len(filtered1)):
  1556. jxde_ = {}
  1557. sl = filtered1.iloc[i]["SL"]##shuliang
  1558. hj = filtered1.iloc[i]["HJ"]##hejia
  1559. rcjID = filtered1.iloc[i]["RcjID"]
  1560. detail = pd.read_csv("de/az/JD_JiXieK.csv")
  1561. filtered2 = detail[detail["RcjID"]==rcjID]
  1562. if len(filtered2) > 0:
  1563. jxbh = filtered2.iloc[0]["jxbh"]
  1564. jxmc = filtered2.iloc[0]["jxmc"]
  1565. DW = filtered2.iloc[0]["DW"]
  1566. tbdj = filtered2.iloc[0]["tbdj"]
  1567. jxde_["jxbh"] = jxbh
  1568. jxde_["jxmc"] = jxmc
  1569. jxde_["DW"] = DW
  1570. jxde_["tbdj"] = tbdj
  1571. jxde_["sl"] = sl
  1572. jxde_["hj"] = hj
  1573. jxde.append(jxde_)
  1574. ####cailiao
  1575. clde = []
  1576. cl = pd.read_csv("de/az/JD_GuJiaCL.csv")
  1577. filtered1 = cl[cl["DEBH"]==debh]
  1578. for i in range(len(filtered1)):
  1579. clde_ = {}
  1580. SL = filtered1.iloc[i]["SL"]##shuliang
  1581. HJ = filtered1.iloc[i]["HJ"]##hejia
  1582. rcjID = filtered1.iloc[i]["RcjID"]
  1583. detail = pd.read_csv("de/az/JD_CaiLiaoK.csv")
  1584. filtered2 = detail[detail["RcjID"]==rcjID]
  1585. if len(filtered2) > 0:
  1586. CLBH = filtered2.iloc[0]["CLBH"]
  1587. CLMC = filtered2.iloc[0]["CLMC"]
  1588. JLDW = filtered2.iloc[0]["JLDW"]
  1589. YSJG = filtered2.iloc[0]["YSJG"]
  1590. clde_["CLBH"] = CLBH
  1591. clde_["CLMC"] = CLMC
  1592. clde_["JLDW"] = JLDW
  1593. clde_["YSJG"] = YSJG
  1594. clde_["SL"] = SL
  1595. clde_["HJ"] = HJ
  1596. clde.append(clde_)
  1597. else:
  1598. detail = pd.read_csv("de/az/JD_PeiBi.csv")
  1599. filtered2 = detail[detail["RcjID"]==rcjID]
  1600. if len(filtered2) > 0:
  1601. CLBH = filtered2.iloc[0]["PBBH"]
  1602. CLMC = filtered2.iloc[0]["PBMC"]
  1603. JLDW = filtered2.iloc[0]["DW"]
  1604. YSJG = filtered2.iloc[0]["PBDJ"]
  1605. clde_["CLBH"] = CLBH
  1606. clde_["CLMC"] = CLMC
  1607. clde_["JLDW"] = JLDW
  1608. clde_["YSJG"] = YSJG
  1609. clde_["SL"] = SL
  1610. clde_["HJ"] = HJ
  1611. clde.append(clde_)
  1612. 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
  1613. def getSingleDeXilie_sz(debh):
  1614. id = None
  1615. bz_selected = []
  1616. bz_selected2 = []
  1617. if "附注" in debh:
  1618. position = debh.find("附注")
  1619. debh = debh[:position]
  1620. if "*" in debh:
  1621. position = debh.find("*")
  1622. debh = debh[:position]
  1623. if debh.endswith("换"):
  1624. debh = debh[:-1]
  1625. if "[" in debh:
  1626. position = debh.find("[")
  1627. debh = debh[:position-1]
  1628. gj = pd.read_csv("de/sz/JD_DanWeiGJ.csv")
  1629. filtered = gj[gj["DEBH"]==debh]
  1630. print(filtered)
  1631. if len(filtered) > 0:
  1632. index = (filtered.iloc[0]["YSDELBH"])
  1633. shu = pd.read_csv("de/sz/JD_DingEShu.csv")
  1634. hit = shu[shu["zjh"]==index]
  1635. if len(hit) > 0:
  1636. id = hit.iloc[0]["ID"]
  1637. beizhu = str(filtered.iloc[0]["BZBH"])
  1638. if 'nan' in beizhu:
  1639. pass
  1640. else:
  1641. beizhus = beizhu.split(";")
  1642. print(beizhus)
  1643. bzfile = pd.read_csv("de/sz/JD_BeiZhuZK.csv")
  1644. bzfile2 = pd.read_csv("de/sz/JD_BeiZhuFK.csv", dtype=str)
  1645. bz_selected = bzfile[bzfile["BZBH"].isin(beizhus)]
  1646. bz_selected2 = bzfile2[bzfile2["BZBH"].isin(beizhus)]
  1647. else:
  1648. return None, None, None, None, None, None, None
  1649. ####rengong
  1650. rgde = []
  1651. rg = pd.read_csv("de/sz/JD_GuJiaRG.csv")
  1652. filtered1 = rg[rg["DEBH"]==debh]
  1653. for i in range(len(filtered1)):
  1654. rgde_ = {}
  1655. gr = filtered1.iloc[i]["RGR"]##gongri
  1656. gf = filtered1.iloc[i]["RGF"]##gongfei
  1657. rcjID = filtered1.iloc[i]["RcjID"]
  1658. detail = pd.read_csv("de/sz/JD_CaiLiaoK.csv")
  1659. filtered2 = detail[detail["RcjID"]==rcjID]
  1660. if len(filtered2) > 0:
  1661. CLBH = filtered2.iloc[0]["CLBH"]
  1662. CLMC = filtered2.iloc[0]["CLMC"]
  1663. JLDW = filtered2.iloc[0]["JLDW"]
  1664. YSJG = filtered2.iloc[0]["YSJG"]
  1665. rgde_["CLBH"] = CLBH
  1666. rgde_["CLMC"] = CLMC
  1667. rgde_["JLDW"] = JLDW
  1668. rgde_["YSJG"] = YSJG.item() if type(YSJG) == float64 else YSJG
  1669. rgde_["gr"] = gr.item() if type(gr) == float64 else gr
  1670. rgde_["gf"] = gf.item() if type(gf) == float64 else gf
  1671. rgde.append(rgde_)
  1672. ##print(rgde)
  1673. ####jixie
  1674. jxde = []
  1675. jx = pd.read_csv("de/sz/JD_GuJiaJX.csv")
  1676. filtered1 = jx[jx["DEBH"]==debh]
  1677. for i in range(len(filtered1)):
  1678. jxde_ = {}
  1679. sl = filtered1.iloc[i]["SL"]##shuliang
  1680. hj = filtered1.iloc[i]["HJ"]##hejia
  1681. rcjID = filtered1.iloc[i]["RcjID"]
  1682. detail = pd.read_csv("de/sz/JD_JiXieK.csv")
  1683. filtered2 = detail[detail["RcjID"]==rcjID]
  1684. if len(filtered2) > 0:
  1685. jxbh = filtered2.iloc[0]["jxbh"]
  1686. jxmc = filtered2.iloc[0]["jxmc"]
  1687. DW = filtered2.iloc[0]["DW"]
  1688. tbdj = filtered2.iloc[0]["tbdj"]
  1689. jxde_["jxbh"] = jxbh
  1690. jxde_["jxmc"] = jxmc
  1691. jxde_["DW"] = DW
  1692. jxde_["tbdj"] = tbdj.item() if type(tbdj) == float64 else tbdj
  1693. jxde_["sl"] = sl.item() if type(sl) == float64 else sl
  1694. jxde_["hj"] = hj.item() if type(hj) == float64 else hj
  1695. jxde.append(jxde_)
  1696. ####cailiao
  1697. clde = []
  1698. cl = pd.read_csv("de/sz/JD_GuJiaCL.csv")
  1699. filtered1 = cl[cl["DEBH"]==debh]
  1700. for i in range(len(filtered1)):
  1701. clde_ = {}
  1702. SL = filtered1.iloc[i]["SL"]##shuliang
  1703. HJ = filtered1.iloc[i]["HJ"]##hejia
  1704. rcjID = filtered1.iloc[i]["RcjID"]
  1705. detail = pd.read_csv("de/sz/JD_CaiLiaoK.csv")
  1706. filtered2 = detail[detail["RcjID"]==rcjID]
  1707. if len(filtered2) > 0:
  1708. CLBH = filtered2.iloc[0]["CLBH"]
  1709. CLMC = filtered2.iloc[0]["CLMC"]
  1710. JLDW = filtered2.iloc[0]["JLDW"]
  1711. YSJG = filtered2.iloc[0]["YSJG"]
  1712. clde_["CLBH"] = CLBH
  1713. clde_["CLMC"] = CLMC
  1714. clde_["JLDW"] = JLDW
  1715. clde_["YSJG"] = YSJG.item() if type(YSJG) == float64 else YSJG
  1716. clde_["SL"] = SL.item() if type(SL) == float64 else SL
  1717. clde_["HJ"] = HJ.item() if type(HJ) == float64 else HJ
  1718. clde.append(clde_)
  1719. else:
  1720. detail = pd.read_csv("de/sz/JD_PeiBi.csv")
  1721. filtered2 = detail[detail["RcjID"]==rcjID]
  1722. if len(filtered2) > 0:
  1723. CLBH = filtered2.iloc[0]["PBBH"]
  1724. CLMC = filtered2.iloc[0]["PBMC"]
  1725. JLDW = filtered2.iloc[0]["DW"]
  1726. YSJG = filtered2.iloc[0]["PBDJ"]
  1727. clde_["CLBH"] = CLBH
  1728. clde_["CLMC"] = CLMC
  1729. clde_["JLDW"] = JLDW
  1730. clde_["YSJG"] = YSJG.item() if type(YSJG) == float64 else YSJG
  1731. clde_["SL"] = SL.item() if type(SL) == float64 else SL
  1732. clde_["HJ"] = HJ.item() if type(HJ) == float64 else HJ
  1733. clde.append(clde_)
  1734. 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
  1735. def getSingleDeXilie_tj(debh):
  1736. id = None
  1737. bz_selected = []
  1738. bz_selected2 = []
  1739. if "附注" in debh:
  1740. position = debh.find("附注")
  1741. debh = debh[:position]
  1742. if "*" in debh:
  1743. position = debh.find("*")
  1744. debh = debh[:position]
  1745. if debh.endswith("换"):
  1746. debh = debh[:-1]
  1747. if "[" in debh:
  1748. position = debh.find("[")
  1749. debh = debh[:position-1]
  1750. gj = pd.read_csv("de/tj/JD_DanWeiGJ.csv")
  1751. filtered = gj[gj["DEBH"]==debh]
  1752. print(filtered)
  1753. if len(filtered) > 0:
  1754. index = int(filtered.iloc[0]["YSDELBH"])
  1755. shu = pd.read_csv("de/tj/JD_DingEShu.csv")
  1756. hit = shu[shu["zjh"]==index]
  1757. if len(hit) > 0:
  1758. id = hit.iloc[0]["ID"]
  1759. beizhu = str(filtered.iloc[0]["BZBH"])
  1760. if 'nan' in beizhu:
  1761. pass
  1762. else:
  1763. beizhus = beizhu.split(";")
  1764. print(beizhus)
  1765. bzfile = pd.read_csv("de/tj/JD_BeiZhuZK.csv")
  1766. bzfile2 = pd.read_csv("de/tj/JD_BeiZhuFK.csv", dtype=str)
  1767. bz_selected = bzfile[bzfile["BZBH"].isin(beizhus)]
  1768. bz_selected2 = bzfile2[bzfile2["BZBH"].isin(beizhus)]
  1769. else:
  1770. return None, None, None, None, None, None, None
  1771. ####rengong
  1772. rgde = []
  1773. rg = pd.read_csv("de/tj/JD_GuJiaRG.csv")
  1774. filtered1 = rg[rg["DEBH"]==debh]
  1775. for i in range(len(filtered1)):
  1776. rgde_ = {}
  1777. gr = filtered1.iloc[i]["RGR"]##gongri
  1778. gf = filtered1.iloc[i]["RGF"]##gongfei
  1779. rcjID = filtered1.iloc[i]["RcjID"]
  1780. detail = pd.read_csv("de/tj/JD_CaiLiaoK.csv")
  1781. filtered2 = detail[detail["RcjID"]==rcjID]
  1782. if len(filtered2) > 0:
  1783. CLBH = filtered2.iloc[0]["CLBH"]
  1784. CLMC = filtered2.iloc[0]["CLMC"]
  1785. JLDW = filtered2.iloc[0]["JLDW"]
  1786. YSJG = filtered2.iloc[0]["YSJG"]
  1787. rgde_["CLBH"] = CLBH
  1788. rgde_["CLMC"] = CLMC
  1789. rgde_["JLDW"] = JLDW
  1790. rgde_["YSJG"] = YSJG.item() if type(YSJG) == float64 else YSJG
  1791. rgde_["gr"] = gr.item() if type(gr) == float64 else gr
  1792. rgde_["gf"] = gf.item() if type(gf) == float64 else gf
  1793. rgde.append(rgde_)
  1794. ##print(rgde)
  1795. ####jixie
  1796. jxde = []
  1797. jx = pd.read_csv("de/tj/JD_GuJiaJX.csv")
  1798. filtered1 = jx[jx["DEBH"]==debh]
  1799. for i in range(len(filtered1)):
  1800. jxde_ = {}
  1801. sl = filtered1.iloc[i]["SL"]##shuliang
  1802. hj = filtered1.iloc[i]["HJ"]##hejia
  1803. rcjID = filtered1.iloc[i]["RcjID"]
  1804. detail = pd.read_csv("de/tj/JD_JiXieK.csv")
  1805. filtered2 = detail[detail["RcjID"]==rcjID]
  1806. if len(filtered2) > 0:
  1807. jxbh = filtered2.iloc[0]["jxbh"]
  1808. jxmc = filtered2.iloc[0]["jxmc"]
  1809. DW = filtered2.iloc[0]["DW"]
  1810. tbdj = filtered2.iloc[0]["tbdj"]
  1811. jxde_["jxbh"] = jxbh
  1812. jxde_["jxmc"] = jxmc
  1813. jxde_["DW"] = DW
  1814. jxde_["tbdj"] = tbdj.item() if type(tbdj) == float64 else tbdj
  1815. jxde_["sl"] = sl.item() if type(sl) == float64 else sl
  1816. jxde_["hj"] = hj.item() if type(hj) == float64 else hj
  1817. jxde.append(jxde_)
  1818. ####cailiao
  1819. clde = []
  1820. cl = pd.read_csv("de/tj/JD_GuJiaCL.csv")
  1821. filtered1 = cl[cl["DEBH"]==debh]
  1822. for i in range(len(filtered1)):
  1823. clde_ = {}
  1824. SL = filtered1.iloc[i]["SL"]##shuliang
  1825. HJ = filtered1.iloc[i]["HJ"]##hejia
  1826. rcjID = filtered1.iloc[i]["RcjID"]
  1827. detail = pd.read_csv("de/tj/JD_CaiLiaoK.csv")
  1828. filtered2 = detail[detail["RcjID"]==rcjID]
  1829. if len(filtered2) > 0:
  1830. CLBH = filtered2.iloc[0]["CLBH"]
  1831. CLMC = filtered2.iloc[0]["CLMC"]
  1832. JLDW = filtered2.iloc[0]["JLDW"]
  1833. YSJG = filtered2.iloc[0]["YSJG"]
  1834. clde_["CLBH"] = CLBH
  1835. clde_["CLMC"] = CLMC
  1836. clde_["JLDW"] = JLDW
  1837. clde_["YSJG"] = YSJG.item() if type(YSJG) == float64 else YSJG
  1838. clde_["SL"] = SL.item() if type(SL) == float64 else SL
  1839. clde_["HJ"] = HJ.item() if type(HJ) == float64 else HJ
  1840. clde.append(clde_)
  1841. else:
  1842. detail = pd.read_csv("de/tj/JD_PeiBi.csv")
  1843. filtered2 = detail[detail["RcjID"]==rcjID]
  1844. if len(filtered2) > 0:
  1845. CLBH = filtered2.iloc[0]["PBBH"]
  1846. CLMC = filtered2.iloc[0]["PBMC"]
  1847. JLDW = filtered2.iloc[0]["DW"]
  1848. YSJG = filtered2.iloc[0]["PBDJ"]
  1849. clde_["CLBH"] = CLBH
  1850. clde_["CLMC"] = CLMC
  1851. clde_["JLDW"] = JLDW
  1852. clde_["YSJG"] = YSJG.item() if type(YSJG) == float64 else YSJG
  1853. clde_["SL"] = SL.item() if type(SL) == float64 else SL
  1854. clde_["HJ"] = HJ.item() if type(HJ) == float64 else HJ
  1855. clde.append(clde_)
  1856. 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
  1857. def getDwgc(root, id, Zylb):
  1858. result = []
  1859. #result.append(["ming cheng", "jin e", "zan gu jia", "anquan wenming fei", "guifei"])
  1860. item = None
  1861. for child in root:
  1862. if child.tag == "Dxgcxx":
  1863. for child1 in child:
  1864. Dwgcbh = child1.attrib["Dwgcbh"]
  1865. if Dwgcbh == id:
  1866. item = child1
  1867. break
  1868. ##result.append([child.attrib["Dxgcmc"], child.attrib["Je"], child.attrib["Zgj"], child.attrib["Aqwmf"], child.attrib["Gf"]])
  1869. id = id + "Zylb" + Zylb
  1870. for child in item:
  1871. if child.tag == "Fywj":
  1872. result.append({"id": id + "bao jia hui zong", "label": "报价汇总表"})
  1873. elif child.tag == "Gfsj":
  1874. result.append({"id": id + "gui fei shui jin", "label": "规费税金"})
  1875. elif child.tag == "Qdxm":
  1876. result.append({"id": id + "qing dan xiang mu", "label": "清单项目"})
  1877. elif child.tag == "Csxm":
  1878. result.append({"id": id + "cuo shi xiang mu", "label": "措施项目"})
  1879. elif child.tag == "Qtxm":
  1880. result.append({"id": id +"qi ta xiang mu", "label": "其他项目"})
  1881. elif child.tag == "Zlje":
  1882. result.append({"id": id +"zan lie jin e", "label": "暂列金额"})
  1883. elif child.tag == "Clzg":
  1884. result.append({"id": id +"cai liao zan gu jia", "label": "材料暂估价"})
  1885. elif child.tag == "Zygczg":
  1886. result.append({"id": id + "zhuan ye gong cheng zan gu jia", "label": "专业工程暂估价"})
  1887. elif child.tag == "Jrg":
  1888. result.append({"id": id + "ji ri gong", "label": "计日工"})
  1889. elif child.tag == "Zcbfwf":
  1890. result.append({"id": id + "zong cheng bao fu wu fei", "label": "总承包服务费"})
  1891. elif child.tag == "Zjxmjdkzffj":
  1892. result.append({"id": id + "zong jia xiang mu jin du kuan zhi fu fen jie", "label": "总价项目进度款支付分解"})
  1893. elif child.tag == "Fbrgycl":
  1894. result.append({"id": id + "fa bao ren gong ying cai liao", "label": "发包人供应材料"})
  1895. elif child.tag == "Cbrgycl":
  1896. result.append({"id": id + "cheng bao ren gong ying cai liao", "label": "承包人供应材料"})
  1897. elif child.tag == "Rcjhz":
  1898. result.append({"id": id + "ren cai ji hui zong", "label": "人材机汇总"})
  1899. else:
  1900. print(child.tag)
  1901. print("WARNING####################################################################")
  1902. return result