service.py 66 KB

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