word.py 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990
  1. #coding:utf-8
  2. """
  3. paths = './采购立项/QZCTG_04.04.V3-2019_科研项目标准招标文件(试行).docx'
  4. # paths = './采购立项/副本水轮发电机组并网监测及同期过程状态评价系统研制采购技术规范(102-CYPC-102-004329-2024-1-A)-1 (3).docx'
  5. paths = './采购立项/结构化-服务类竞争性谈判文件(标准版)(试行)-采购公告-综合评分法.docx'
  6. csv = '数据.xlsx'
  7. from docx import Document
  8. # 加载Word文档
  9. doc = Document(paths)
  10. beg_pag = ''
  11. # 读取并打印每段的内容
  12. for para in doc.paragraphs[:200]:
  13. # if '_' in para.text:
  14. # print(para.text)
  15. beg = ''
  16. end = ''
  17. flag = 0
  18. index = 0
  19. for run in para.runs:
  20. index = index + 1
  21. # 打印文本以及其格式
  22. #print(run.text, run.font.name, run.font.size, run.underline)
  23. if run.underline:
  24. print('run',run.text)
  25. flag = 1
  26. continue
  27. if flag == 1:
  28. if index <=2 and beg == 0:
  29. print(run.text, '*****', beg_pag)
  30. else:
  31. print(run.text, '----', beg)
  32. flag = 0
  33. beg = run.text
  34. # # 如果run包含域
  35. # if run.fields:
  36. # for field in run.fields:
  37. # print(f"域名称: {field.name}, 文本: {field.text}")
  38. if flag == 1:
  39. print('----', beg)
  40. beg_pag = para.text
  41. """
  42. import re
  43. import Levenshtein
  44. import requests
  45. import json
  46. import re
  47. import Levenshtein
  48. import json
  49. aaa = """|序号|项目编码|项目名称|项目特征|单位|工程量|全费用综合单价|合价|备注|
  50. |1 |0116050020 01 |踢脚线拆除|1、瓷砖踢脚线,高度15-20cm;2、含砂浆凿除,凿除至墙面基层。|m2 |2000 |14.2 |28400 ||
  51. |2 |0116050010 01 |地砖及砂浆层凿除|1、施工部位:非设备区域;2、与非施工区域地面交界处做好地砖保护,破坏地砖进行恢复。3 、地砖及砂浆层凿除,凿除至混凝土基层,厚度约5-8cm,以现场实际为准。4、凿除设备和施工方法需考虑降尘,以及震动对电站设备的影响。|m2 |20000 |14.2 |284000 ||
  52. |3 |0116050010 02 |地砖凿除|1、施工部位:设备区域及周边;2、仅凿除地砖,厚度为1-2cm,以现场实际为准。|m2 |1000 |14.2 |14200 ||
  53. |4 |0101030020 01 |垃圾清理外运|1、垃圾类型:凿除的地砖、踢脚线及砂浆层、地面铣刨层;2、建筑垃圾场内转运及外运运距由承包方自行考虑,外运地点需满足环保要求,并告知发包方;3、含垃圾消纳费。|m3 |1743 |113.36 |197586.48 ||
  54. |5 |0116020020 5 01 |基面铣刨|1、地面整体铣刨,深度≥3mm;2、使用无尘设备,考虑震动对电气设备的影响。|m2 |20000 |8.18 |163600 ||
  55. |6 |0111020030 01 |预制无机磨石施工|1、成品预制无机磨石,颜色与无机磨石整体施工相一致,厚度大于等于20mm;2、预制磨石铺贴,2cm干混地面砂浆DS M20;3、不低于西卡、绰琪、迈拓品牌。具体详见技术方案,材料垂直运输及二次转运由承包人自行考虑|m2 |1000 |621.57 |624570 ||
  56. |7 |0115020010 01 |护边角钢|1、部位:地坪收边;2、304哑光不锈钢角钢;3、不锈钢角钢规格为50×50×3mm;具体详见图纸及技术方案,材料垂直运输及二次转运由承包人自行考|m |2000 |171.13 |342260||
  57. ||||虑||||||
  58. |8 |0111010010 01 |抗裂砂浆垫层|1、部位:不具备钢纤维混凝土运输条件的部位;2、成品抗裂砂浆垫层(非现场搅拌砂浆后添加外加剂),具备低收缩早强快干性能;3、成品焊接钢筋网片直径8mm、间距150mm×150mm;4、厚度约5cm,以实际情况为准,成品品牌与无机磨石一致。具体详见技术方案,材料垂直运输及二次转运由承包人自行考虑|m2 |7000 |150.42 |1052940 ||
  59. |9 |0111010030 01 |C25混凝土|1、C25细石商品混凝土垫层,厚度5-8cm,以现场实际为准;2、覆膜养护具体详见图纸及技术方案,材 料垂直运输及二次转运由承包人自行考虑|m2 |14000 |68.6 |960400 ||
  60. |10 |01B004 |钢纤维|1、钢纤维于拌合站添加至混凝土内,掺量为每立方米混凝土40-50kg 钢纤维;2、抗拉强度不低于380MPa;具体详见技术方案,材料垂直运输及二次转运由承包人自行考虑|t |50 |6780 |339000 ||
  61. |11 |0111010020 01 |无机磨石|1、无机磨石地坪,厚度≥10mm,骨料粒径6-8mm,骨料以石英石为主;2、防污抗渗罩面。3、铝镁分隔 条(包含墙脚分隔条);4、无机磨石体系尺寸变化率不大于0.05%,莫氏硬度6级及以上,抗折强度不小于6Mpa,抗压强度不小于30Mpa,无机磨石表面平整度2 米靠尺不大于2mm。5、不低于绰琪鑫磨石、迈拓FREAZZO自然岩采系列、西卡Sikafloor 55 Terrazzo CM系列品牌 。具体详见技术方案,材料垂直运输及二次转运由承包人自行考虑|m2 |20000 |519.77 |10395400 ||
  62. |12 |0111050060 01 |不锈钢踢脚线|1、施工部位:电站厂房;2、成品哑光拉丝304不锈钢踢脚线,面板整体厚度≥1mm,高度15cm;3、专用卡扣固定,每米不少于两个;4、含成品不锈钢阴阳角线及封头等配件。具体详见技术方案,材料垂直运输及二次转运由承包人自行 考虑|m |10000 |105.73 |1057300 ||
  63. |13 |0112030010 01 |墙面零星抹灰|1、部位:原踢脚线拆除后的墙面;2、1.20厚干混抹灰砂浆DP M10抹灰具体详见技术方案,材料垂 直运输及二次转运由承包人自行考虑|m2 |2000 |47.96 |95920 ||
  64. |14 |0114060010 01 |墙面乳胶漆恢复|1、部位:原踢脚线拆除后的墙面;2、墙面修补,抗碱底漆二遍、内墙腻子二遍、面漆二遍。3、不低于多乐士、立邦、华润等产品性能参数。具体详见技术方案,材料垂直运输及二次转运由承包人自行考虑|m2 |500 |22.3 |11150 ||
  65. |15 |0402050060 15 01 |定置管理划线(环氧地坪漆)|1. 部位:设备周边、通道周边等其他地面;2. 划线宽度100mm,底漆二遍、中漆一遍、面漆二遍;3.环氧地坪漆不低于巴斯夫、马贝、西卡等产品性能参数;具体详见图纸及技术方案,材料垂直运输及二次转运由承包人自行考虑|㎡|400 |75.8 |30320 ||
  66. |16 |0109040040 01 |成品地面结构缝装置|1、施工部位:地坪结构缝;2、成品承重型不锈钢结构缝装置,宽度15cm;3、盖板材质:铝合金或者不锈钢面板厚度不小于3mm;4、不锈钢基座,不锈钢滑杆@500,M8金属膨胀螺栓@300(交错排列),3mm不锈钢止水带,阻火带 、填缝胶具体详见技术方案,材料垂直运输及二次转运由承包人自行考虑|m |1000 |178 |178000 ||
  67. |17 |01B002 |设备防护措施|设备防护措施1、部分施工区域有电气盘柜,施工过程包含防尘、防火、防水、防碰撞、防飞溅、防污染、 防较大震动等防护;2、地面凿除及地坪施工时,对电气设备使用彩钢板、油布等材料做好防护。3、防护方案由承包人报发包方审批。具体详见技术方案,材料垂直运输及二次转运由承包人自行考虑|m |5000 |14.1 |70500 ||
  68. |||合计(其中,安全文明施工费157500元。不含垃圾清运费用)|合计(其中,安全文明施工费157500元。不含垃圾清运费用)|合计( 其中,安全文明施工费157500元。不含垃圾清运费用)|合计(其中,安全文明施工费157500元。不含垃圾清运费用)|合计(其中,安全文明施工费157500元。不含垃圾清运费用)|||"""
  69. aaa2 = """|序号|项目名称|含税报价(元)|其中|其中|其中|
  70. |序号|项目名称|含税报价(元)|增值税税率(%)|增值税金额(元)|安全文明施工费(元)|
  71. |1 |三峡左岸电站及地下电站地坪整治|15845546.48 |9% |1426099.18 |157500 |"""
  72. aaa3 = """|序号|项目名称|服务内容|单位|数量|税率|不含税价格|含税合价|备注|\n|1|建设基础调研|(1)针对国内外物联网技术的应用现状及发展方向进行调研分析;(2)针对公司核心业务现状进行调研分析;(3)针对公司物联网技术应用现状进行调研分析;|项|1|6%|291000|308460|详见表2:人工费分项报价表|\n|2|设计需求分析|(1)面向长江电力及所属单位(公司)用户开展业务需求调研分析;(2)针对物联网及物联管理平台的应用等开展需求分析。|项|1|6%|255000|270300|详见表2:人工费分项报价表|\n|3|物联网技术应用路线设计|结合调研及需求分析情况,明确公司物联网的建设技术路线,完成物联网技术的技术路线、应用实施、安全管理、运维保障等内容的设计,形成设计方案。|项|1|6%|425000|450500|详见表2:人工费分项报价表|\n|4|物联管理平台详细设计|根据物联网技术应用路线设计,开展长江电力物联管理平台详细设计,包括管理平台系统架构、功能架构、部署方式以及相应接口、数据、模型、网络安全等内容,形成相应的技术标准及详细设计方案,满足长江电力物联网技术应用需求。|项|1|6%|510000|540600|详见表2:人工费分项报价表|\n|5|典型应用场景物联网建设设计|针对典型应用场景,基于网络基础设施现状,对前端物联感知设备选型、安装、网络通信链路的建设、后端应用系统的开发、部署以及后续运维等方面提出可操作的实施方案,并提供相应的项目预算及相关计算方法|项|1|6%|595000|630700|详见表2:人工费分项报价表|\n|||与依据。|||||||\n|6|组织专家评审|组织方案评审专题会议,邀请至少5名公司外部专家(职称要求至少为大学教授或者相关企业高工)参加方案评审,并提交评审报告。|项|1|6%|100000|106000||\n|7|设计成果落地支持服务|(1)为后续项目的采购、实施以及关键节点验收等提供技术支持;(2)根据后续建设项目具体实施情况,完善建设规范及设计方案等。|||6%|680000|720800|详见表2:人工费分项报价表|\n|合计|合计|合计||||2856000|3027360||"""
  73. aaa4="""|等|项目名称|单位|数量|单价(元)|合价(元)|备注|\n|一|工作经费||||24430700||\n|1|劳务费||||18400000||\n|1.1|教授级高工|人日|360|1500|540000|2人×180日|\n|1.2|高级工程师|人日|3000|1200|3600000|10人×300日|\n|1.3|工程师|人日|7500|1000|7500000|15人×500日|\n|1.4|助理工程师|人日|9000|800|7200000|12人×750日|\n|2|咨询费|项|1|364000|364000|支付外部专家咨询费|\n|3|会议费|项|1|1553100|1553100|召开技术讨论、咨询会|\n|4|差旅费|项|1|2853600|2853600|往返交通费、住宿费、出差补贴|\n|5|出版/文献/信息传播/知识产权事务费|项|1|1260000|1260000|论文版面费、资料费等|\n|二|管理费|项|1|1492242|1492242|费率:6%|\n|三|利润|项|1|||费率:%|\n|四|税费|项|1|1581777|1581777|费率:6%|\n|五|合计|元|||27944719|一+二+三+四|"""
  74. aaa_list = aaa.split('\n')
  75. aaa2_list = aaa2.split('\n')
  76. aaa3_list = aaa3.split('\n')
  77. aaa4_list = aaa4.split('\n')
  78. # if '合计' in aaa2_list[-1]:
  79. # aaa2_list = aaa2_list[:-1]
  80. # if '合计' in aaa_list[-1]:
  81. # aaa_list = aaa_list[:-1]
  82. # if '合计' in aaa3_list[-1]:
  83. # aaa3_list = aaa3_list[:-1]
  84. for i in range(len(aaa2_list)):
  85. aaa2_list[i] = re.split('\|', aaa2_list[i][1:-1])
  86. for i in range(len(aaa_list)):
  87. aaa_list[i] = re.split('\|', aaa_list[i][1:-1])
  88. for i in range(len(aaa3_list)):
  89. aaa3_list[i] = re.split('\|', aaa3_list[i][1:-1])
  90. for i in range(len(aaa4_list)):
  91. aaa4_list[i] = re.split('\|', aaa4_list[i][1:-1])
  92. def table_titer(aaa2_list):
  93. if not aaa2_list:
  94. return aaa2_list
  95. beg_flag = 0
  96. # if not '序号' in aaa2_list[0]:
  97. # aaa2_list[0][0] = '序号'
  98. for i in range(len(aaa2_list)):
  99. beg_flag = i
  100. if '序号' in aaa2_list[i] or '名称' in str(aaa2_list[i]) or aaa2_list[i][0]==None:
  101. continue
  102. else:
  103. break
  104. for j in range(len(aaa2_list[0])):
  105. if aaa2_list[0][j] != None:
  106. word_name = aaa2_list[0][j]
  107. else:
  108. word_name = ''
  109. for i in range(1, beg_flag):
  110. if aaa2_list[i][j] == aaa2_list[i-1][j] or aaa2_list[i][j] == None:
  111. continue
  112. else:
  113. if aaa2_list[i][j] != None:
  114. word_name = word_name + aaa2_list[i][j]
  115. # print(word_name)
  116. aaa2_list[beg_flag-1][j] = word_name
  117. # print(beg_flag)
  118. # print(aaa2_list[beg_flag-1:])
  119. return aaa2_list[beg_flag-1:]
  120. pdf_aaa2 = [['序号','项目名称','含税报价(元)','其中',None,None],
  121. [None,None,None,'增值税税率(%)','增值税金额(元)','安全文明施工费(元)'],
  122. ['1','三峡左岸电站及地下电站地坪整治','15845546.48','9%','1426099.18','157500']]
  123. # 清标-报价部分表格抽取
  124. # 分项报价表
  125. # 单价 全费用综合单价
  126. # 合价 合价
  127. # 单位 单位
  128. # 数量 数量、工程量、工作量
  129. # 名称 项目名称、名称
  130. # 报价汇总表
  131. # 税率 增值税税率
  132. # 总价 含税总价、含税报价
  133. # 增值税 增值税金额、增值税额
  134. # 不含税总价 不含税合价
  135. # 投标文件
  136. # table 表头,表格跨页
  137. def table_head(aaa_list):
  138. table_key = []
  139. aaa_list = table_titer(aaa_list)
  140. # print(aaa_list)
  141. for i in range(len(aaa_list)):
  142. empty_num = 0
  143. for j in range(len(aaa_list[i])):
  144. aaa_list[i][j] = aaa_list[i][j].strip()
  145. if not aaa_list[i][j]:
  146. empty_num = empty_num + 1
  147. # print(i, empty_num, len(aaa_list[i])*0.75)
  148. if empty_num > len(aaa_list[i])*0.63:
  149. if i == len(aaa_list) - 1 and '合计' in str(aaa_list[i]):
  150. continue
  151. try:
  152. if float(aaa_list[i][0]) - float(aaa_list[i-1][0]) == 1:
  153. flag_x = 1
  154. except:
  155. flag_x = -1
  156. for j in range(len(aaa_list[i])):
  157. if aaa_list[i+flag_x][j] != None:
  158. aaa_list[i][j] = aaa_list[i+flag_x][j] + aaa_list[i][j]
  159. aaa_list[i+flag_x][j] = ''
  160. print('xxxx',aaa_list[i])
  161. return aaa_list
  162. print('------------->', table_head(pdf_aaa2))
  163. aaa_list = table_head(aaa_list)
  164. aaa2_list = table_head(aaa2_list)
  165. aaa3_list = table_head(aaa3_list)
  166. aaa4_list = table_head(aaa4_list)
  167. index_list = """unitPrice 全费用综合单价、单价、单价(元)
  168. totalPrice 合价、含税合价、合价(元)
  169. totalPrice2 不含税价格
  170. unit 单位
  171. quantity 数量、工程量、工作量
  172. proNum 序号
  173. projectName 项目名称、名称
  174. taxRate 增值税税率、税率
  175. taxIncludedTotal 含税总价、含税报价
  176. taxExcludedTotal 不含税合价"""
  177. key_words = {}
  178. for a in index_list.split('\n'):
  179. aa = a.split(' ')
  180. # print(aa)
  181. key_words[aa[0]]=aa[-1].split('、')
  182. # 计算ocr识别文本与标准信息的相似度
  183. def text_sim(word, black_lists):
  184. _json = {}
  185. for word_key in black_lists:
  186. # print(word_key.lower(), word)
  187. for ww in black_lists[word_key]:
  188. if ww == word:
  189. return word_key
  190. sim_score = Levenshtein.ratio(ww, word)
  191. if(sim_score > 0.9):
  192. return word_key
  193. if not word_key in _json:
  194. _json[word_key] = sim_score
  195. if word_key in _json and sim_score > _json[word_key]:
  196. _json[word_key] = sim_score
  197. datas = sorted(_json.items(), key=lambda x:x[1], reverse=True)
  198. # print('xx'*10, datas)
  199. if datas[0][1] > 0.6:
  200. return datas[0][0]
  201. else:
  202. return ''
  203. quote_res_json = {
  204. "proNum":"",
  205. "projectName": "",
  206. "unit": "",
  207. "quantity": "",
  208. "taxRate": "",
  209. "unitPrice": "",
  210. "totalPrice": "",
  211. "totalPrice2":""
  212. }
  213. money_json_list = []
  214. taxRate = ''
  215. taxExcludedTotal = ''
  216. taxIncludedTotal = ''
  217. index_list_json = {}
  218. # 报价汇总表
  219. for i in range(len(aaa2_list[0])):
  220. # print(aaa2_list[0][i], text_sim(aaa2_list[0][i], key_words))
  221. word_name = text_sim(aaa2_list[0][i], key_words)
  222. if word_name:
  223. aaa2_list[0][i] = word_name
  224. if word_name == 'taxRate' and '%' in aaa2_list[1][i]:
  225. taxRate = aaa2_list[1][i]
  226. if word_name == 'taxIncludedTotal':
  227. taxIncludedTotal = aaa2_list[1][i]
  228. if word_name == 'taxExcludedTotal':
  229. taxExcludedTotal = aaa2_list[1][i]
  230. #分项报价表、工程量清单报价表
  231. def get_money_data(aaa_list, key_words, taxRate):
  232. _index_json = {}
  233. money_json_list = []
  234. if not '序号' in aaa_list[0]:
  235. aaa_list[0][0] = '序号'
  236. for i in range(len(aaa_list[0])):
  237. # print(aaa_list[0][i], text_sim(aaa_list[0][i], key_words))
  238. word_name = text_sim(aaa_list[0][i], key_words)
  239. # print(word_name)
  240. if word_name:
  241. aaa_list[0][i] = aaa_list[0][i] + ',' + word_name
  242. else:
  243. continue
  244. for j in range(1, len(aaa_list)):
  245. empty_num = 0
  246. # print(aaa_list[j])
  247. for x in range(len(aaa_list[j])):
  248. if not aaa_list[j][x]:
  249. empty_num = empty_num + 1
  250. if empty_num > len(aaa_list[j])*0.9:
  251. continue
  252. try:
  253. money_json_list[_index_json[j]][word_name] = aaa_list[j][i]
  254. except:
  255. _json = {
  256. "proNum":"",
  257. "projectName": "",
  258. "unit": "",
  259. "quantity": "",
  260. "taxRate": taxRate,
  261. "unitPrice": "",
  262. "totalPrice": "",
  263. "totalPrice2":""
  264. }
  265. _json[word_name] = aaa_list[j][i]
  266. _index_json[j] = len(money_json_list)
  267. money_json_list.append(_json)
  268. # print(_index_json)
  269. for money_index in range(len(money_json_list)):
  270. if not money_json_list[money_index]['unit']:
  271. money_json_list[money_index]['unit'] = '项'
  272. if not money_json_list[money_index]['quantity']:
  273. money_json_list[money_index]['quantity'] = '1'
  274. if not money_json_list[money_index]['unitPrice'] and money_json_list[money_index]['quantity'] == '1':
  275. money_json_list[money_index]['unitPrice'] = money_json_list[money_index]['totalPrice']
  276. return money_json_list
  277. money_data = get_money_data(aaa_list, key_words, taxRate)
  278. # money_data = get_money_data(aaa3_list, key_words, taxRate)
  279. money_data = get_money_data(aaa4_list, key_words, taxRate)
  280. print(money_data)
  281. # print(aaa4_list)
  282. if '合计' in money_data[-1]['projectName']:
  283. if money_data[-1]['totalPrice']:
  284. taxIncludedTotal = money_data[-1]['totalPrice']
  285. if money_data[-1]['totalPrice2']:
  286. taxExcludedTotal = money_data[-1]['totalPrice2']
  287. money_data = money_data[:-1]
  288. print(money_data)
  289. # "calQuoteRes": {
  290. # "avgPrice": "28393.96",
  291. # "benchmarkPrice": "28393.96",
  292. # "suppliers": [
  293. # {
  294. # "name": "供应商A",
  295. # "taxIncludedTotal": "32915.00",
  296. # "taxExcludedTotal": "28829.20",
  297. # "deviationRate": "0.01533",
  298. # "score": "90.333",
  299. # "finalScore": "28.00"
  300. # }]
  301. cal_quote_res_json = {"suppliers":[],"avgPrice":"","benchmarkPrice":""}
  302. supplier = {
  303. "name":"",
  304. "taxIncludedTotal":"",
  305. "taxExcludedTotal":"",
  306. "deviationRate":"",
  307. "score":"",
  308. "finalScore":""
  309. }
  310. company_name = '供应商名称A'
  311. quote_res_json = {
  312. "proNum":"",
  313. "projectName": "",
  314. "unit": "",
  315. "quantity": "",
  316. "taxRate": "",
  317. "unitPrice": "",
  318. "totalPrice": "",
  319. "totalPrice2":""
  320. }
  321. quote_res_list = []
  322. for money in money_data:
  323. quote_res_json = {
  324. "proNum":money['proNum'],
  325. "projectName": money['projectName'],
  326. "unit": money['unit'],
  327. "quantity": money['quantity'],
  328. "suppliers":[{
  329. "name": company_name,
  330. "taxRate": money['taxRate'],
  331. "finalQuote": {
  332. "unitPrice": money['unitPrice'],
  333. "totalPrice": money['totalPrice']
  334. },
  335. "taxCompareRes": {
  336. "theoryValue": "",
  337. "deviation": ""
  338. },
  339. "finalExcludeTaxPrice": {
  340. "unitPrice": money['totalPrice2'],
  341. "totalPrice": money['totalPrice2']
  342. }
  343. }]
  344. }
  345. quote_res_list.append(quote_res_json)
  346. cal_quote_res_json = {"suppliers":[],"avgPrice":"","benchmarkPrice":""}
  347. supplier = {
  348. "name":company_name,
  349. "taxIncludedTotal":taxIncludedTotal,
  350. "taxExcludedTotal":taxExcludedTotal,
  351. "deviationRate":"",
  352. "score":"",
  353. "finalScore":""
  354. }
  355. cal_quote_res_json['suppliers'].append(supplier)
  356. # print(quote_res_list)
  357. result_money_data = {
  358. "calMethod": "当0<Di≤3%时,每高1%扣1分;\n当3%<Di≤6%时,每高1%扣2分;\n当6%<Di,每高1%扣3分;\n当-3%<Di≤0时,不扣分;\n当-6%<Di≤-3%时,每低1%扣1分;\n当-9%<Di≤-6%时,每低1%扣2分;\n当Di≤-9%时,每低1%扣3分;\n满分为100分,最低得60分。\n上述计分按分段累进计算,当入围报价人评审价与评审价基准值B比例值(偏差率)处于分段计算区间内时,分段计算按内插法等比例计扣分。",
  359. "scoreWeight": "30%",
  360. "quoteRes":quote_res_list,
  361. "calQuoteRes":cal_quote_res_json
  362. }
  363. import json
  364. print(json.dumps(result_money_data, ensure_ascii=False))
  365. #报价得分
  366. def quotation_score(aaa2_list, aaa_list, company_name='供应商A', score_weight='', cal_method=''):
  367. index_list = """unitPrice 全费用综合单价、单价、单价(元)
  368. totalPrice 合价、含税合价、合价(元)
  369. totalPrice2 不含税价格
  370. unit 单位
  371. quantity 数量、工程量、工作量
  372. proNum 序号
  373. projectName 项目名称、名称
  374. taxRate 增值税税率、税率
  375. taxIncludedTotal 含税总价、含税报价
  376. taxExcludedTotal 不含税合价"""
  377. key_words = {}
  378. for a in index_list.split('\n'):
  379. a = a.strip()
  380. aa = a.split(' ')
  381. # print(aa)
  382. key_words[aa[0]]=aa[-1].split('、')
  383. aaa_list = table_head(aaa_list)
  384. aaa2_list = table_head(aaa2_list)
  385. taxExcludedTotal = ''
  386. taxRate = ''
  387. taxIncludedTotal = ''
  388. # print(aaa2_list)
  389. # 报价汇总表
  390. # print(len(aaa2_list))
  391. if len(aaa2_list) == 2:
  392. # print(aaa2_list)
  393. for i in range(len(aaa2_list[0])):
  394. # print(aaa2_list[0][i], text_sim(aaa2_list[0][i], key_words))
  395. word_name = text_sim(aaa2_list[0][i], key_words)
  396. # print(word_name)
  397. if word_name:
  398. aaa2_list[0][i] = word_name
  399. if word_name == 'taxRate' and '%' in aaa2_list[1][i]:
  400. taxRate = aaa2_list[1][i]
  401. if word_name == 'taxIncludedTotal':
  402. taxIncludedTotal = aaa2_list[1][i]
  403. if word_name == 'taxExcludedTotal':
  404. taxExcludedTotal = aaa2_list[1][i]
  405. money_data = get_money_data(aaa_list, key_words, taxRate)
  406. if '合计' in money_data[-1]['projectName']:
  407. if money_data[-1]['totalPrice']:
  408. taxIncludedTotal = money_data[-1]['totalPrice']
  409. if money_data[-1]['totalPrice2']:
  410. taxExcludedTotal = money_data[-1]['totalPrice2']
  411. money_data = money_data[:-1]
  412. print(money_data)
  413. # "calQuoteRes": {
  414. # "avgPrice": "28393.96",
  415. # "benchmarkPrice": "28393.96",
  416. # "suppliers": [
  417. # {
  418. # "name": "供应商A",
  419. # "taxIncludedTotal": "32915.00",
  420. # "taxExcludedTotal": "28829.20",
  421. # "deviationRate": "0.01533",
  422. # "score": "90.333",
  423. # "finalScore": "28.00"
  424. # }]
  425. cal_quote_res_json = {"suppliers":[],"avgPrice":"","benchmarkPrice":""}
  426. supplier = {
  427. "name":"",
  428. "taxIncludedTotal":"",
  429. "taxExcludedTotal":"",
  430. "deviationRate":"",
  431. "score":"",
  432. "finalScore":""
  433. }
  434. quote_res_json = {
  435. "proNum":"",
  436. "projectName": "",
  437. "unit": "",
  438. "quantity": "",
  439. "taxRate": "",
  440. "unitPrice": "",
  441. "totalPrice": "",
  442. "totalPrice2":""
  443. }
  444. quote_res_list = []
  445. for money in money_data:
  446. quote_res_json = {
  447. "proNum":money['proNum'],
  448. "projectName": money['projectName'],
  449. "unit": money['unit'],
  450. "quantity": money['quantity'],
  451. "suppliers":[{
  452. "name": company_name,
  453. "taxRate": money['taxRate'],
  454. "finalQuote": {
  455. "unitPrice": money['unitPrice'],
  456. "totalPrice": money['totalPrice']
  457. },
  458. "taxCompareRes": {
  459. "theoryValue": "",
  460. "deviation": ""
  461. },
  462. "finalExcludeTaxPrice": {
  463. "unitPrice": money['totalPrice2'],
  464. "totalPrice": money['totalPrice2']
  465. }
  466. }]
  467. }
  468. quote_res_list.append(quote_res_json)
  469. cal_quote_res_json = {"suppliers":[],"avgPrice":"","benchmarkPrice":""}
  470. supplier = {
  471. "name":company_name,
  472. "taxIncludedTotal":taxIncludedTotal,
  473. "taxExcludedTotal":taxExcludedTotal,
  474. "deviationRate":"",
  475. "score":"",
  476. "finalScore":""
  477. }
  478. cal_quote_res_json['suppliers'].append(supplier)
  479. print(cal_quote_res_json)
  480. result_money_data = {
  481. "calMethod": cal_method,
  482. "scoreWeight": score_weight,
  483. "quoteRes":quote_res_list,
  484. "calQuoteRes":cal_quote_res_json
  485. }
  486. print(result_money_data)
  487. return result_money_data
  488. cal_method = "当0<Di≤3%时,每高1%扣1分;\n当3%<Di≤6%时,每高1%扣2分;\n当6%<Di,每高1%扣3分;\n当-3%<Di≤0时,不扣分;\n当-6%<Di≤-3%时,每低1%扣1分;\n当-9%<Di≤-6%时,每低1%扣2分;\n当Di≤-9%时,每低1%扣3分;\n满分为100分,最低得60分。\n上述计分按分段累进计算,当入围报价人评审价与评审价基准值B比例值(偏差率)处于分段计算区间内时,分段计算按内插法等比例计扣分。"
  489. score_weight = "30%"
  490. company_name = '派维斯'
  491. aaa_list = aaa.split('\n')
  492. aaa2_list = aaa2.split('\n')
  493. aaa3_list = aaa3.split('\n')
  494. import time
  495. # time.sleep(10)
  496. for i in range(len(aaa2_list)):
  497. aaa2_list[i] = re.split('\|', aaa2_list[i][1:-1])
  498. # time.sleep(10)
  499. for i in range(len(aaa_list)):
  500. aaa_list[i] = re.split('\|', aaa_list[i][1:-1])
  501. # time.sleep(10)
  502. for i in range(len(aaa3_list)):
  503. # time.sleep(10)
  504. aaa3_list[i] = re.split('\|', aaa3_list[i][1:-1])
  505. # time.sleep(10)
  506. quotation_score([], aaa3_list, company_name, score_weight, cal_method)
  507. aaa = [
  508. [
  509. "序号",
  510. "项目编码",
  511. "项目名称",
  512. "项目特征",
  513. "",
  514. "",
  515. "",
  516. "单位 工程量",
  517. "全费用综\n合单价",
  518. "合价",
  519. "备注"
  520. ],
  521. [
  522. "1",
  523. "0116050020\n01",
  524. "踢脚线拆除",
  525. "1、瓷砖踢脚线,高度 15-20cm;\n2、含砂浆凿除,凿除至墙面基层。",
  526. "",
  527. "",
  528. "m2",
  529. "2000",
  530. "10.35",
  531. "20700",
  532. ""
  533. ],
  534. [
  535. "2",
  536. "0116050010\n01",
  537. "地砖及砂浆\n层凿除",
  538. "1、施工部位:非设备区域;\n2、与非施工区域地面交界处做好地砖保护,破坏地砖进行恢复。\n3、地砖及砂浆层凿除,凿除至混凝土基层,厚度约 5-8cm,以现场实\n际为准。\n4、凿除设备和施工方法需考虑降尘,以及震动对电站设备的影响。",
  539. "",
  540. "",
  541. "m2",
  542. "20000",
  543. "10.21",
  544. "204200",
  545. ""
  546. ],
  547. [
  548. "3",
  549. "0116050010\n02",
  550. "地砖凿除",
  551. "1、施工部位:设备区域及周边;\n2、仅凿除地砖,厚度为 1-2cm,以现场实际为准。",
  552. "",
  553. "",
  554. "m2",
  555. "1000",
  556. "10.21",
  557. "10210",
  558. ""
  559. ],
  560. [
  561. "4",
  562. "0101030020\n01",
  563. "垃圾清理外\n运",
  564. "1、垃圾类型:凿除的地砖、踢脚线及砂浆层、地面铣刨层;\n2、建筑垃圾场内转运及外运运距由承包方自行考虑,外运地点需满\n足环保要求,并告知发包方;\n3、含垃圾消纳费。",
  565. "",
  566. "",
  567. "m3",
  568. "1743",
  569. "259.02",
  570. "451471.86",
  571. ""
  572. ],
  573. [
  574. "5",
  575. "0116020020\n01",
  576. "基面铣刨",
  577. "1、地面整体铣刨,深度≥3mm;\n2、使用无尘设备,考虑震动对电气设备的影响。",
  578. "",
  579. "",
  580. "m2",
  581. "20000",
  582. "5.17",
  583. "103400",
  584. ""
  585. ],
  586. [
  587. "6",
  588. "0111020030\n01",
  589. "预制无机磨\n石施工",
  590. "1、成品预制无机磨石,颜色与无机磨石整体施工相一致,厚度大于\n等于 20mm;\n2、预制磨石铺贴,2cm 干混地面砂浆 DS\nM20;\n3、不低于西卡、绰琪、迈拓品牌。\n具体详见技术方案,材料垂直运输及二次转运由承包人自行考虑",
  591. "",
  592. "",
  593. "m2",
  594. "1000",
  595. "327",
  596. "327000",
  597. ""
  598. ],
  599. [
  600. "",
  601. "",
  602. "",
  603. "",
  604. "",
  605. "",
  606. "",
  607. "",
  608. "",
  609. "",
  610. ""
  611. ],
  612. [
  613. "7",
  614. "0115020010\n01",
  615. "护边角钢",
  616. "1、部位:地坪收边;\n2、304 哑光不锈钢角钢;\n3、不锈钢角钢规格为 50×50×3mm;\n具体详见图纸及技术方案,材料垂直运输及二次转运由承包人自行考\n虑",
  617. "",
  618. "",
  619. "m",
  620. "2000",
  621. "24.93",
  622. "49860",
  623. ""
  624. ],
  625. [
  626. "8",
  627. "0111010010 ",
  628. "抗裂砂浆垫层",
  629. "1、部位:不具备钢纤维混凝土运输条件的部位;\n2、成品抗裂砂浆垫层(非现场搅拌砂浆后添加外加剂),具备低收",
  630. "",
  631. "",
  632. "m2",
  633. "7000",
  634. "214.08",
  635. "1498560",
  636. ""
  637. ],
  638. [
  639. "",
  640. "01",
  641. "",
  642. "缩早强快干性能;\n3、成品焊接钢筋网片直径 8mm、间距 150mm×150mm;\n4、厚度约 5cm,以实际情况为准,成品品牌与无机磨石一致。\n具体详见技术方案,材料垂直运输及二次转运由承包人自行考虑",
  643. "",
  644. "",
  645. "",
  646. "",
  647. "",
  648. "",
  649. ""
  650. ],
  651. [
  652. "9",
  653. "0111010030\n01",
  654. "C25 混凝土",
  655. "1、C25 细石商品混凝土垫层,厚度 5-8cm,以现场实际为准;\n2、覆膜养护\n具体详见图纸及技术方案,材料垂直运输及二次转运由承包人自行考\n虑",
  656. "",
  657. "",
  658. "m2",
  659. "14000",
  660. "72.51",
  661. "1015140",
  662. ""
  663. ],
  664. [
  665. "10",
  666. "01B004",
  667. "钢纤维",
  668. "1、钢纤维于拌合站添加至混凝土内,掺量为每立方米混凝土 40-50kg\n钢纤维;\n2、抗拉强度不低于 380MPa;\n具体详见技术方案,材料垂直运输及二次转运由承包人自行考虑",
  669. "",
  670. "",
  671. "t",
  672. "50",
  673. "3182.05",
  674. "159102.5",
  675. ""
  676. ],
  677. [
  678. "11",
  679. "0111010020\n01",
  680. "无机磨石",
  681. "1、无机磨石地坪,厚度≥10mm,骨料粒径 6-8mm,骨料以石英石为主;\n2、防污抗渗罩面。\n3、铝镁分隔条(包含墙脚分隔条);\n4、无机磨石体系尺寸变化率不大于 0.05%,莫氏硬度 6 级及以上,抗\n折强度不小于 6Mpa,抗压强度不小于 30Mpa,无机磨石表面平整度 2\n米靠尺不大于 2mm。\n5、不低于绰琪鑫磨石、迈拓 FREAZZO 自然岩采系列、西卡 Sikafloor\n55\nTerrazzo CM 系列品牌。\n具体详见技术方案,材料垂直运输及二次转运由承包人自行考虑",
  682. "",
  683. "",
  684. "m2",
  685. "20000",
  686. "427.16",
  687. "8543200",
  688. ""
  689. ],
  690. [
  691. "12",
  692. "0111050060\n01",
  693. "不锈钢踢脚\n线",
  694. "1、施工部位:电站厂房;\n2、成品哑光拉丝 304 不锈钢踢脚线,面板整体厚度≥1mm,高度 15cm;\n3、专用卡扣固定,每米不少于两个;\n4、含成品不锈钢阴阳角线及封头等配件。\n具体详见技术方案,材料垂直运输及二次转运由承包人自行考虑",
  695. "",
  696. "",
  697. "m",
  698. "10000",
  699. "72.56",
  700. "725600",
  701. ""
  702. ],
  703. [
  704. "13",
  705. "0112030010\n01",
  706. "墙面零星抹\n灰",
  707. "1、部位:原踢脚线拆除后的墙面;\n2、1.20 厚干混抹灰砂浆 DP M10 抹灰",
  708. "",
  709. "",
  710. "",
  711. "",
  712. "",
  713. "",
  714. ""
  715. ],
  716. [
  717. "",
  718. "",
  719. "",
  720. "",
  721. "具体详见技术方案,材料垂直运输及二次转运由承包人自行考虑",
  722. "",
  723. "m2",
  724. "2000",
  725. "79.87",
  726. "159740",
  727. ""
  728. ],
  729. [
  730. "14",
  731. "0114060010\n01",
  732. "墙面乳胶漆\n恢复",
  733. "1、部位:原踢脚线拆除后的墙面;\n2、墙面修补,抗碱底漆二遍、内墙腻子二遍、面漆二遍。\n3、不低于多乐士、立邦、华润等产品性能参数。",
  734. "具体详见技术方案,材料垂直运输及二次转运由承包人自行考虑",
  735. "",
  736. "m2",
  737. "500",
  738. "26.49",
  739. "13245",
  740. ""
  741. ],
  742. [
  743. "15",
  744. "0402050060\n01",
  745. "定置管理划\n线(环氧地坪\n漆)",
  746. "1. 部位:设备周边、通道周边等其他地面;\n2. 划线宽度 100mm,底漆二遍、中漆一遍、面漆二遍;\n3.环氧地坪漆不低于巴斯夫、马贝、西卡等产品性能参数;\n具体详见图纸及技术方案,材料垂直运输及二次转运由承包人自行考",
  747. "",
  748. "",
  749. "㎡",
  750. "400",
  751. "106.42",
  752. "42568",
  753. ""
  754. ],
  755. [
  756. "",
  757. "",
  758. "",
  759. "虑",
  760. "",
  761. "",
  762. "",
  763. "",
  764. "",
  765. "",
  766. ""
  767. ],
  768. [
  769. "16",
  770. "0109040040\n01",
  771. "成品地面结\n构缝装置",
  772. "1、施工部位:地坪结构缝;\n2、成品承重型不锈钢结构缝装置,宽度 15cm;\n3、盖板材质:铝合金或者不锈钢面板厚度不小于 3mm;\n4、不锈钢基座,不锈钢滑杆@500,M8 金属膨胀螺栓@300(交错排列),\n3mm 不锈钢止水带,阻火带、填缝胶\n具体详见技术方案,材料垂直运输及二次转运由承包人自行考虑",
  773. "",
  774. "",
  775. "m",
  776. "1000",
  777. "339.97",
  778. "339970",
  779. ""
  780. ],
  781. [
  782. "17",
  783. "01B002",
  784. "设备防护措\n施",
  785. "设备防护措施\n1、部分施工区域有电气盘柜,施工过程包含防尘、防火、防水、防\n碰撞、防飞溅、防污染、防较大震动等防护;\n2、地面凿除及地坪施工时,对电气设备使用彩钢板、油布等材料做\n好防护。\n3、防护方案由承包人报发包方审批。\n具体详见技术方案,材料垂直运输及二次转运由承包人自行考虑",
  786. "",
  787. "",
  788. "m",
  789. "5000",
  790. "109",
  791. "545000",
  792. ""
  793. ],
  794. [
  795. "",
  796. "",
  797. "合计(其中,安全文明施工费_35224.89_元。)",
  798. "",
  799. "",
  800. "",
  801. "",
  802. "",
  803. "",
  804. "14208967.36",
  805. ""
  806. ]
  807. ]
  808. result_money_data = quotation_score(aaa2_list, aaa_list, company_name, score_weight, cal_method)
  809. url_quote = "http://222.92.111.18:8006/bm/alg/result_check_quote"
  810. result_data={
  811. "projectId": "8",
  812. "projectName": "新项目",
  813. # "bidderUnit":"派维斯",
  814. "quote":result_money_data
  815. }
  816. with open('报价评审.txt', 'w', encoding='utf-8') as ff:
  817. ff.write(json.dumps(result_data, indent=4, ensure_ascii=False))
  818. req = requests.post(url_quote, json=result_data)
  819. print(req.json())
  820. def main(client_id, client_secret):
  821. url = "https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id={}&client_secret={}".format(client_id, client_secret)
  822. payload = ""
  823. headers = {
  824. 'Content-Type': 'application/json',
  825. 'Accept': 'application/json'
  826. }
  827. response = requests.request("POST", url, headers=headers, data=payload)
  828. print(response.text)
  829. return response.json()
  830. client_id = 'DFIQUMXb59oGUDkvGhTw15mE'
  831. client_secret = 'F5LkFLo4TatiLcCcJgIXbJrv5Kw04Rf0'
  832. # access_token = main(client_id, client_secret)['access_token']
  833. access_token = "24.920c071e4f4b20c8ea17bbdd901a8793.2592000.1722560550.282335-86574608"
  834. import requests
  835. import os
  836. def create_task(url, file_path, file_url):
  837. """
  838. Args:
  839. url: string, 服务请求链接
  840. file_path: 本地文件路径
  841. file_url: 文件链接
  842. Returns: 响应
  843. """
  844. # 文件请求
  845. body = {
  846. "file": (os.path.basename(file_path), open(file_path, 'rb'), "multipart/form-data"),
  847. }
  848. # 文件链接请求
  849. # body = {
  850. # "file_url": (file_url, "multipart/form-data")
  851. # }
  852. data = {
  853. "file_name": os.path.basename(file_path),
  854. "return_para_nodes": True
  855. }
  856. response = requests.post(url, data=data, files=body)
  857. return response.json()
  858. import requests
  859. def query_task(url, task_id):
  860. """
  861. Args:
  862. url: string, 请求链接
  863. task_id: string, task id
  864. Returns: 响应
  865. """
  866. data = {
  867. "task_id": task_id
  868. }
  869. response = requests.post(url, data=data, files=data)
  870. return response.json()
  871. request_host = f"https://aip.baidubce.com/file/2.0/brain/online/v1/parser/task?access_token={access_token}"
  872. # # file_path = "test.pdf"
  873. # file_path = "J:/0智能招采系统/code/项目采购中心/5-10个项目-采购中心/长江电力生产经营管理数字化平台项目计划与预算管理示范应用研发/(未签章)生产经营管理数字化平台项目计划与预算管理示范应用研发采购文件.pdf"
  874. # file_path = "J:/0智能招采系统/code/项目采购中心/5-10个项目-采购中心/长江电力物联网技术及物联管理平台设计/长江电力物联网技术及物联管理平台设计项目报价文件.pdf"
  875. # file_path = 'J:/0智能招采系统/code/三峡左岸地坪商务标_合并.pdf'
  876. # file_path = 'c7cb8827a0f8b5f47fbf28e36a462e5.png'
  877. # file_path = '1721789655830.jpg'
  878. # file_path = '1721807633906.jpg'
  879. # file_path = 'J:/0智能招采系统/code/项目采购中心/3-10个项目-采购中心/进一步优化乌东德工程运行控制水位提升综合效益关键技术研究/中铁水利/1组合_1.pdf'
  880. # print(request_host)
  881. # response = create_task(request_host, file_path, "")
  882. # print(response)
  883. # import json
  884. # task_id = "task-xuPhWlg4stY6z7XPuD1zYJ3NSlP0Ayaw"
  885. # task_id = 'task-Q8Y8WrbSoJ0spVCxu56wKk3DKBgobUwc'
  886. # task_id = 'task-6831Kc8vrILiDKh9qiB0OAdOG7JGqEYV'
  887. # task_id = 'task-fO5wbccAeKq3u2YPWBAEW8fYliiToY29'
  888. # task_id = 'task-KCoyhK7wOOrup45Rx2B8UR3WIIAFHGSf'
  889. # task_id = 'task-DrLk1EdMp72ry2FsypuUT9gPzFFAxcUL'
  890. # task_id = 'task-9hrxzD35HKTeyaoS92UUpya9qZP1MRN6'
  891. # request_host = f"https://aip.baidubce.com/file/2.0/brain/online/v1/parser/task/query?access_token={access_token}"
  892. # resp = query_task(request_host, task_id)
  893. # print(resp)
  894. # print(resp['result']['parse_result_url'])
  895. # resp = requests.get(resp['result']['parse_result_url'])