guangxi_common.js 64 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895
  1. // INTERFACE_EXPORT =,必须这么写,这样才能在导出时动态加载脚本后,覆盖前端代码
  2. INTERFACE_EXPORT = (() => {
  3. "use strict";
  4. const feeRateMap = {
  5. 冬季施工增加费: "DJSGZJFFL",
  6. 冬季施工: "DJSGZJFFL",
  7. 雨季施工增加费: "YUJSGZJFFL",
  8. 雨季施工: "YUJSGZJFFL",
  9. 夜间施工增加费: "YEJSGZJFFL",
  10. 夜间施工: "YEJSGZJFFL",
  11. 高原地区施工增加费: "GYDQSGZJFFL",
  12. 高原施工: "GYDQSGZJFFL",
  13. 风沙地区施工增加费: "FSDQSGZJFFL",
  14. 风沙施工: "FSDQSGZJFFL",
  15. 沿海地区施工增加费: "YHDQSGZJFFL",
  16. 沿海施工: "YHDQSGZJFFL",
  17. 行车干扰施工增加费: "XCGRGCSGZJFFL",
  18. 行车干扰: "XCGRGCSGZJFFL",
  19. 工地转移费: "GDZYFFL",
  20. '工地转移(km)': "GDZYFFL",
  21. 施工辅助费: "SGFZFFL",
  22. 施工辅助: "SGFZFFL",
  23. 基本费用: "JBFYFL",
  24. 主副食运费补贴: "ZFSYFBTFL",
  25. '综合里程(km)': "ZFSYFBTFL",
  26. 职工探亲路费: "ZGTQLFFL",
  27. 职工探亲: "ZGTQLFFL",
  28. 职工取暖补贴: "ZGQNBTFL",
  29. 职工取暖: "ZGQNBTFL",
  30. 财务费用: "CWFYFL",
  31. 养老保险费: "YANGLBXFFL",
  32. 失业保险费: "SYBXFFL",
  33. 医疗保险费: "YILBXFFL",
  34. 工伤保险费: "GSBXFL",
  35. 养老保险: "YANGLBXFFL",
  36. 失业保险: "SYBXFFL",
  37. 医疗保险: "YILBXFFL",
  38. 工伤保险: "GSBXFL",
  39. 住房公积金: "ZFGJJFL",
  40. 规费: "GFZHFL",
  41. 利润: "LRL",
  42. 税金: "SL",
  43. 土方: "TF",
  44. 石方: "SF",
  45. 运输: "YS",
  46. 路面: "LM",
  47. "路面(不计雨)": "LM",
  48. 隧道: "SD",
  49. 构造物I: "GZW1",
  50. "构造物I(不计冬)": "GZW1",
  51. "构造物I(不计雨)": "GZW1",
  52. 构造物II: "GZW2",
  53. "构造物III(桥梁)": "GZW3",
  54. "构造物III(除桥以外)": "GZW3",
  55. "构造物III(除桥以外不计雨夜)": "GZW3",
  56. 技术复杂大桥: "JSFZDQ",
  57. "钢材及钢结构(桥梁)": "GJG",
  58. "钢材及钢结构(除桥以外)": "GJG",
  59. "钢材及钢结构(除桥以外不计夜)": "GJG",
  60. };
  61. //计算程序有,这里没有:施工机械使用费\施工机械人工费\定额人工费\定额材料费\定额施工机械使用费
  62. const itemFeeMap = {
  63. 'marketLabour': 'RGF',
  64. 'marketMaterial': 'CLF',
  65. 'marketMachine':'JXSYF',
  66. 'marketEquipment': 'SBGZF',
  67. 'direct': 'DEZJF',
  68. 'equipment': 'DESBF',
  69. 'marketDirect': 'ZJF',
  70. 'measure': 'CSF',
  71. 'measure1': 'CSF1',
  72. 'measure2': 'CSF2',
  73. 'manage': 'QYGLF',
  74. 'force': 'GF',
  75. 'profit': 'LR',
  76. 'tax': 'SJ',
  77. 'common': 'JAF',
  78. 'rationCommon': 'DEJAF'
  79. };
  80. const feeLibNoMap = {
  81. 'eba0e7c0-cfe6-11ea-ba15-739be477d1fe': 'GYSFL-000000-2018-86',
  82. '451d3180-e02e-11ea-8056-1514dfc2f39e': 'GYSFL-340000-2019-210',
  83. '32923ff0-e912-11ea-8b20-d93bc370e960': 'GYSFL-440000-2019-544'
  84. };
  85. const FixedCostMap = {
  86. //折旧费、检修费、维护费、安拆辅助费
  87. '折旧费': 1,
  88. '检修费': 1,
  89. '维护费': 1,
  90. '安拆辅助费':1
  91. }
  92. const RoadGradeMap = {
  93. "高速公路": "0",
  94. "一级公路": "1",
  95. "二级公路": "2",
  96. "三级公路": "3",
  97. "四级公路": "4",
  98. "等外公路": "5",
  99. "独立桥梁": "6",
  100. "独立隧道": "7"
  101. }
  102. const sectionNameMap = {
  103. "清单 第100章 总则": true,
  104. "清单 第200章 路基": true,
  105. "清单 第300章 路面": true,
  106. "清单 第400章 桥梁、涵洞": true,
  107. "清单 第500章 隧道": true,
  108. "清单 第600章 安全设施及预埋管线": true,
  109. "清单 第700章 绿化及环境保护设施": true,
  110. // "清单 第800章 机电工程": true,
  111. // "清单 第900章 附属区房建工程":true
  112. }
  113. const ListCodeMap = {
  114. "第100章至700章清单合计":["1", "A"],
  115. "清单 第100章 总则": ["一", "A1"],
  116. "清单 第200章 路基": ["二", "A2"],
  117. "清单 第300章 路面": ["三", "A3"],
  118. "清单 第400章 桥梁、涵洞": ["四", "A4"],
  119. "清单 第500章 隧道": ["五", "A5"],
  120. "清单 第600章 安全设施及预埋管线": ["六", "A6"],
  121. "清单 第700章 绿化及环境保护设施": ["七", "A7"],
  122. // "清单 第800章 机电工程": "八",
  123. // "清单 第900章 附属区房建工程": "九",
  124. "已包含在清单合计中的材料、工程设备、专业工程暂估价合计": ["8", "B"],
  125. "清单合计减去材料、工程设备、专业工程暂估价合计": ["9", "C"],
  126. "计日工合计": ["10", "D"],
  127. "劳务": ["10.1", "D1"],
  128. "材料": ["10.2", "D2"],
  129. "机械": ["10.3", "D3"],
  130. "暂列金额(不含计日工总额)": ["11", "E"],
  131. "投标报价": ["12", "Total"]
  132. }
  133. const ratioCodeMap = {
  134. "01ZJF":"0",
  135. "02JXF":"1",
  136. "03WHF":"2",
  137. "04ACFZF":"3"
  138. }
  139. function getBasePrice(projectGLJID, tenderProject) {
  140. let glj = _.find(tenderProject.projectGLJ.datas.gljList, {
  141. id: projectGLJID
  142. })
  143. return glj ? gljUtil.getBasePrice(glj, null, null, null, decimalObj, false, _, scMathUtil) : 0;
  144. }
  145. function getFeeRate(programID, fieldName, tenderProject) {
  146. let rate = 0;
  147. let template = tenderProject.calcProgram.compiledTemplates;
  148. if (template[programID]) {
  149. let item = _.find(template[programID].calcItems, {
  150. fieldName: fieldName
  151. })
  152. if (item) rate = item.feeRate;
  153. }
  154. return rate
  155. }
  156. function billNameChecking(bNode,projectName,fixedFlag) {
  157. let data = bNode.data;
  158. let fail = null;
  159. let pass = true;
  160. if (data.flagsIndex && data.flagsIndex.fixed) {
  161. let flag = data.flagsIndex.fixed.flag;
  162. switch (flag) {
  163. case fixedFlag.ONE_SEVEN_BILLS:
  164. pass = data.name == "第100章至700章清单" || data.name == "第100章至700章清单合计";
  165. break;
  166. case fixedFlag.PROVISIONAL_TOTAL:
  167. pass = data.name == "已包含在清单合计中的材料、工程设备、专业工程暂估价合计";
  168. break;
  169. case fixedFlag.BILLS_TOTAL_WT_PROV:
  170. pass = data.name == "清单合计减去材料、工程设备、专业工程暂估价合计";
  171. break;
  172. case fixedFlag.DAYWORK_LABOR:
  173. pass = data.name == "计日工合计";
  174. break;
  175. /*
  176. case fixedFlag.LABOUR_SERVICE:
  177. pass = data.name == "劳务";
  178. break;
  179. case fixedFlag.MATERIAL:
  180. pass = data.name == "材料";
  181. break;
  182. case fixedFlag.CONSTRUCTION_MACHINE:
  183. pass = data.name == "机械";
  184. break;
  185. //*/
  186. case fixedFlag.PROVISIONAL:
  187. pass = data.name == "暂列金额(不含计日工总额)";
  188. break;
  189. case fixedFlag.TOTAL_COST:
  190. pass = data.name == "投标报价";
  191. break;
  192. case fixedFlag.ONE_HUNDRED_BILLS:
  193. pass = data.name == "清单 第100章 总则";
  194. break;
  195. }
  196. } else {
  197. if (bNode.parent) {
  198. const pdata = bNode.parent.data;
  199. if (pdata.flagsIndex && pdata.flagsIndex.fixed && pdata.flagsIndex.fixed.flag == fixedFlag.ONE_SEVEN_BILLS) {
  200. if (!sectionNameMap[data.name]) pass = false
  201. }
  202. }
  203. }
  204. if(pass == false)fail = { hint: `清单:"${data.name?data.name:""}",名字不符合规范!`, type: projectName }
  205. return fail;
  206. }
  207. /**
  208. *
  209. * @param {String} areaKey - 地区标识,如:'安徽@马鞍山',有些地区的接口只是取值上有不同,共有一个接口脚本, 需要通过地区标识确定一些特殊处理
  210. * @param {Number} exportKind - 导出类型,招标、投标、控制价
  211. * @param {Object} projectData - 项目表数据:{ 建设项目Data, children: [单位工程...] }
  212. * @param {Object} tenderDetailMap - 单位工程ID与getData接口数据(projectObj.project的结构)的映射。
  213. * @return {Promise<Array>} - 返回的数据结构必须按照规定:[{ data, exportKind, fileName }],参考web\building_saas\standard_interface\index.js中的注释说明
  214. */
  215. async function entry(areaKey, exportKind, projectData, tenderDetailMap) {
  216. const {
  217. CONFIG: {
  218. TYPE
  219. },
  220. UTIL,
  221. Element
  222. } = INTERFACE_EXPORT_BASE;
  223. const {
  224. EXPORT_KIND: {
  225. BID_INVITATION,
  226. BID_SUBMISSION,
  227. CONTROL
  228. },
  229. fixedFlag,
  230. } = window.commonConstants;
  231. let cprjType = {
  232. 1: "QDYS", // 招标
  233. 2: "QDYS", // 投标
  234. 3: "QDYS", // 控制价
  235. };
  236. const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
  237. const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
  238. const isControl = exportKind === CONTROL; // 是否是控制价
  239. function emptyElement(name) {
  240. this.name = name;
  241. this.attrs = [];
  242. this.children = [];
  243. }
  244. // 建设项目根节点信息
  245. function CprjInfo(projectName) {
  246. let baseInfo = _.find(projectData.property.basicInformation, {
  247. dispName: "基本信息",
  248. });
  249. let zbr = _.find(baseInfo.items, { "key": "tendereeName" });
  250. let Zbdljg = _.find(baseInfo.items, { "key": "proxy" });
  251. let Shijian = _.find(baseInfo.items, { "key": "compileDate" });
  252. let Zbbh = _.find(baseInfo.items, { "key": "projNum" });
  253. const attrs = [{
  254. name: "CprjName",
  255. value: projectName,
  256. },
  257. {
  258. name: "CprjType",
  259. value: cprjType[exportKind],
  260. },
  261. {
  262. name: "Zbbh",
  263. value: Zbbh?Zbbh.value:""
  264. },
  265. {
  266. name: "Zbr",
  267. value: zbr?zbr.value:""
  268. },
  269. {
  270. name: "Zbdljg",
  271. value: Zbdljg?Zbdljg.value:""
  272. },
  273. {
  274. name: "ShiJian",
  275. value: Shijian?Shijian.value:""
  276. },
  277. {
  278. name: "KeyId",
  279. value: uuid.v1()
  280. }
  281. ];
  282. Element.call(this, "CprjInfo", attrs);
  283. }
  284. // 项目基本信息
  285. function SystemInfo(projectData) {
  286. let baseInfo = _.find(projectData.property.basicInformation, {
  287. dispName: "基本信息",
  288. });
  289. //“招标工程量清单”、“招标控制价”时,输出该字段,为导出该文件的当前时间
  290. let makeData = {
  291. value : UTIL.getNowFormatTime(true)
  292. }
  293. //投标的时候取基本信息的makeData字段
  294. if(isBidSubmission) makeData = _.find(baseInfo.items, { "key": "makeDate" });
  295. let hardID = UTIL.generateHardwareId();
  296. let [cpuId, diskId, macId] = hardID.split(";");
  297. const attrs = [{
  298. name: "Name",
  299. value: "广西公路工程造价文件数据交换标准化规定",
  300. },
  301. {
  302. name: "Version",
  303. value: "1.0",
  304. },
  305. {
  306. name: "SoftwareName",
  307. value: "纵横公路云造价",
  308. },
  309. {
  310. name: "SoftwareVer",
  311. value: "V" + VERSION,
  312. },
  313. {
  314. name: "SoftwareCompany",
  315. value: "珠海纵横创新软件有限公司",
  316. },
  317. {
  318. name: "MakeDate",
  319. value: makeData?makeData.value:"",
  320. },
  321. {
  322. name: "SoftwareNumber",
  323. value: window.btoa(userID),
  324. },
  325. {
  326. name: "HardNumber",
  327. value: window.btoa(diskId),
  328. },
  329. {
  330. name: "MacAddress",
  331. value: window.btoa(macId),
  332. },
  333. {
  334. name: "KeyId",
  335. value: uuid.v1()
  336. }
  337. ];
  338. if (isBidSubmission)
  339. attrs.splice(6, 0, {
  340. name: "BidderVer",
  341. value: UTIL.getNowFormatTime(true),
  342. });
  343. Element.call(this, "SystemInfo", attrs);
  344. }
  345. //造价依据
  346. function CostBasis() {
  347. // ItemStandardNo="GYSFX-000000-2018-86"
  348. const attrs = [{
  349. name: "MakeRuleNo",
  350. value: "GYSBB-000000-2018-86",
  351. },
  352. {
  353. name: "MakeRuleName",
  354. value: "公路工程建设项目概算预算编制办法",
  355. },
  356. {
  357. name: "ItemStandardNo",
  358. value: "GYSFX-000000-2018-86",
  359. },
  360. {
  361. name: "KeyId",
  362. value: uuid.v1()
  363. }
  364. ];
  365. Element.call(this, "CostBasis", attrs);
  366. //定额库信息
  367. //to do 改成实际的值
  368. function NormLib() {
  369. const attrs = [{
  370. name: "NormLibNo",
  371. value: "YSDE-000000-2018-86",
  372. },
  373. {
  374. name: "NormLibName",
  375. value: "部颁公路工程预算定额(2018)",
  376. },
  377. {
  378. name: "Type",
  379. value: "ZDEK",
  380. },
  381. {
  382. name: "KeyId",
  383. value: uuid.v1()
  384. },
  385. ];
  386. Element.call(this, "NormLib", attrs);
  387. }
  388. this.children.push(new NormLib());
  389. }
  390. function Rate(tenderProject, feeRateInfo, seirNo) {
  391. //RateNo="1" Name="纵横软件测试版本" RateLibNo="GYSFL-000000-2018-86"
  392. const attrs = [{
  393. name: "RateNo",
  394. value: seirNo,
  395. },
  396. {
  397. name: "Name",
  398. value: feeRateInfo.name,
  399. },
  400. {
  401. name: "RateLibNo",
  402. value: feeLibNoMap[feeRateInfo.libID],
  403. },
  404. {
  405. name: "KeyId",
  406. value: uuid.v1()
  407. }
  408. ];
  409. Element.call(this, "Rate", attrs);
  410. let RateParams = new emptyElement("RateParams");
  411. RateParams.attrs = [{
  412. name: "KeyId",
  413. value: uuid.v1()
  414. }];
  415. let subRates = projectObj.project.FeeRate.getAllSubRates(feeRateInfo.rates);
  416. for (let s of subRates) {
  417. let sname = s.name.replace("(%)", "");
  418. sname = sname.replace("(%)", "");
  419. if (feeRateMap[sname]) {
  420. let value = "";
  421. if (s.editable) {
  422. let sel = _.find(s.optionList, {
  423. selected: true,
  424. });
  425. if (sel) {
  426. value = sel.name;
  427. } else if (gljUtil.isDef(s.value)) {
  428. value = s.value;
  429. }
  430. } else {
  431. value = _.findIndex(s.optionList, {
  432. selected: true,
  433. });
  434. if (value == -1) value = 0;
  435. }
  436. /* if (sname == '利润') tenderProject.ProfitRate = value;
  437. if (sname == '税金') tenderProject.TaxRate = value; */
  438. RateParams.children.push(new RateParam(feeRateMap[sname], value));
  439. }
  440. }
  441. this.children.push(RateParams);
  442. function RateParam(RateTypeNo, RateParamNo) {
  443. //<RateParam RateTypeNo="DJSGZJFFL" RateParamNo="0" Ratio="100"/>
  444. const attrs = [{
  445. name: "RateTypeNo",
  446. value: RateTypeNo,
  447. },
  448. {
  449. name: "RateParamNo",
  450. value: RateParamNo,
  451. },
  452. {
  453. name: "Ratio",
  454. value: "100",
  455. },
  456. {
  457. name: "KeyId",
  458. value: uuid.v1()
  459. }
  460. ];
  461. Element.call(this, "RateParam", attrs);
  462. }
  463. let RateValues = new emptyElement("RateValues");
  464. RateValues.attrs = [{
  465. name: "KeyId",
  466. value: uuid.v1()
  467. }];
  468. function RateValue(CostTypeNo, RateTypeNo, value) {
  469. const attrs = [{
  470. name: "CostTypeNo",
  471. value: CostTypeNo,
  472. },
  473. {
  474. name: "RateTypeNo",
  475. value: RateTypeNo,
  476. },
  477. {
  478. name: "RateValue",
  479. value: value,
  480. },
  481. {
  482. name: "KeyId",
  483. value: uuid.v1()
  484. }
  485. ];
  486. Element.call(this, "RateValue", attrs);
  487. }
  488. let prefix = "";
  489. for (let r of feeRateInfo.rates) {
  490. if (!r.ParentID && feeRateMap[r.name]) prefix = feeRateMap[r.name];
  491. if (feeRateMap[r.name] && r.ParentID) {
  492. RateValues.children.push(new RateValue(prefix, feeRateMap[r.name], r.rate));
  493. }
  494. }
  495. this.children.push(RateValues);
  496. }
  497. function Pract(tpdata, seriNo) {
  498. let pgljData = tpdata.projectGLJ.datas;
  499. let decimalObj = tpdata.property.decimal;
  500. let ccsObj = $("#vvTax")[0];
  501. const attrs = [{
  502. name: "PractNo",
  503. value: seriNo,
  504. },
  505. {
  506. name: "Name",
  507. value: pgljData.constData.usedUnitPriceInfo.name,
  508. },
  509. {
  510. name: "TaxLibNo",
  511. value: ccsObj.options[ccsObj.selectedIndex].text //读取车船税标准名称
  512. },
  513. {
  514. name: "PriceFileNo",
  515. value: "JGXX"
  516. },
  517. {
  518. name: "KeyId",
  519. value: uuid.v1()
  520. }
  521. ];
  522. Element.call(this, "Pract", attrs);
  523. let Param = {
  524. name: "Param",
  525. attrs: [{
  526. name: "TaxLibNo",
  527. value: "CCSBZ-440000-2019-544",
  528. },
  529. {
  530. name: "AuxRate",
  531. value: pgljData.constData.assistProductionFeeRate,
  532. },
  533. ],
  534. children: [],
  535. };
  536. if (isBidSubmission || isControl) { //导出到招标文件中,不输出这一部分。
  537. let elecDatas = electrovalenceObj.getElectrovalenceDatas(null, pgljData.com_electrovalence, pgljData.gljList);
  538. electrovalenceObj.calcPertElectrovalenceMarketPrice(elecDatas);
  539. for (let e of elecDatas) {
  540. let Electro = {
  541. name: "Electro",
  542. attrs: [{
  543. name: "Code",
  544. value: e.code,
  545. },
  546. {
  547. name: "Price",
  548. value: e.electPrice,
  549. },
  550. {
  551. name: "Ratio",
  552. value: e.coe,
  553. },
  554. ],
  555. children: [],
  556. };
  557. Param.children.push(Electro);
  558. }
  559. }
  560. // this.children.push(Param);
  561. function Mp(g) {
  562. const attrs = [{
  563. name: "Code",
  564. value: g.code,
  565. },
  566. {
  567. name: "PractName",
  568. value: g.name,
  569. },
  570. {
  571. name: "Spec",
  572. value: g.specs,
  573. },
  574. {
  575. name: "Unit",
  576. value: g.unit,
  577. },
  578. {
  579. name: "BudgetPrice",
  580. value: g.priceInfo.tenderPrice,
  581. },
  582. {
  583. name: "NormPrice",
  584. value: g.priceInfo.basePrice,
  585. },
  586. {
  587. name: "IsAdd",
  588. value: g.unit_price.is_add,
  589. },
  590. ];
  591. Element.call(this, "Mp", attrs);
  592. }
  593. function Material(g) {
  594. const attrs = [{
  595. name: "Code",
  596. value: g.code,
  597. },
  598. {
  599. name: "PractName",
  600. value: g.name,
  601. },
  602. {
  603. name: "Spec",
  604. value: g.specs,
  605. },
  606. {
  607. name: "Unit",
  608. value: g.unit,
  609. },
  610. {
  611. name: "BudgetPrice",
  612. value: g.priceInfo.tenderPrice,
  613. },
  614. {
  615. name: "NormPrice",
  616. value: g.priceInfo.basePrice,
  617. },
  618. {
  619. name: "IsAdd",
  620. value: g.unit_price.is_add,
  621. },
  622. {
  623. name: "OrgPrice",
  624. value: g.unit_price.originalPrice ? g.unit_price.originalPrice : 0,
  625. },
  626. {
  627. name: "TransFee",
  628. value: g.unit_price.unitFreight ? g.unit_price.unitFreight : 0,
  629. },
  630. {
  631. name: "GwRate",
  632. value: g.unit_price.grossWeightCoe_n ? g.unit_price.grossWeightCoe_n : 0,
  633. },
  634. {
  635. name: "OffSiteLf",
  636. value: g.unit_price.offSiteTransportLossRate_n ? g.unit_price.offSiteTransportLossRate_n : 0,
  637. },
  638. {
  639. name: "OnSiteLf",
  640. value: 0,
  641. },
  642. {
  643. name: "LoadLf",
  644. value: g.unit_price.handlingLossRate_n ? g.unit_price.handlingLossRate_n : 0,
  645. },
  646. {
  647. name: "StoreRate",
  648. value: g.unit_price.purchaseStorageRate_n ? g.unit_price.purchaseStorageRate_n : 0,
  649. },
  650. {
  651. name: "PackageRecycleFee",
  652. value: g.unit_price.packageRecoverValue ? g.unit_price.packageRecoverValue : 0,
  653. },
  654. ];
  655. Element.call(this, "Material", attrs);
  656. // if (g.unit_price.calcMaterial == 1) { //有材料计算
  657. // let index = gljUtil.getIndex(g);
  658. // let orList = [];
  659. // for (let o of pgljData.originalList) {
  660. // if (o.connect_key == index) orList.push(new OrgPrices(o));
  661. // }
  662. // if (orList.length > 0) this.children = orList;
  663. // }
  664. function CostStructure(r) {
  665. //待获取
  666. this.name = "CostStructure";
  667. this.attrs = [];
  668. this.children = [];
  669. }
  670. function Consume(r, o) {
  671. this.name = "Consume";
  672. this.attrs = [];
  673. this.children = [];
  674. for (let g of o.ration_gljs) {
  675. if (g.rationID == r.ID) {
  676. let r_quantity = scMathUtil.roundForObj(r.quantity, tpdata.property.decimal.ration.quantity);
  677. this.children.push(new ConsumeItem(g, r_quantity));
  678. }
  679. }
  680. }
  681. function ConsumeItem(g, ration_quantity) {
  682. const attrs = [{
  683. name: "Code", //待获取
  684. value: g.code,
  685. },
  686. {
  687. name: "Consumption",
  688. value: scMathUtil.roundForObj(ration_quantity * parseFloat(g.quantity), tpdata.property.decimal.glj.quantity),
  689. },
  690. ];
  691. Element.call(this, "ConsumeItem", attrs);
  692. }
  693. function Norm(r, o) {
  694. const attrs = [{
  695. name: "NormLibNo", //待获取
  696. value: "",
  697. },
  698. {
  699. name: "DisplayCode",
  700. value: r.code,
  701. },
  702. {
  703. name: "Name",
  704. value: r.name,
  705. },
  706. {
  707. name: "Unit",
  708. value: r.unit,
  709. },
  710. {
  711. name: "Num",
  712. value: r.quantity,
  713. },
  714. {
  715. name: "CostTypeNo",
  716. value: "", //待获取
  717. },
  718. {
  719. name: "FabricationCost", //待获取
  720. value: "",
  721. },
  722. {
  723. name: "AdjustStatus",
  724. value: "",
  725. },
  726. ];
  727. Element.call(this, "Norm", attrs);
  728. this.children.push(new CostStructure(r));
  729. this.children.push(new Consume(r, o));
  730. }
  731. function SelfCollect(o) {
  732. const attrs = [{
  733. name: "OtherCost",
  734. value: 0,
  735. }, ];
  736. Element.call(this, "SelfCollect", attrs);
  737. for (let r of o.rations) {
  738. this.children.push(new Norm(r, o));
  739. }
  740. }
  741. function OrgPrices(o) {
  742. const attrs = [{
  743. name: "OrgPricevalue",
  744. value: o.supplyPrice,
  745. },
  746. {
  747. name: "Ratio",
  748. value: o.coe,
  749. },
  750. ];
  751. Element.call(this, "OrgPrices", attrs);
  752. if (!o.rations) return;
  753. this.children.push(new SelfCollect(o));
  754. }
  755. }
  756. function Mech(g,gljKeyMap) {
  757. const attrs = [{
  758. name: "Code",
  759. value: g.code,
  760. },
  761. {
  762. name: "PractName",
  763. value: g.name,
  764. },
  765. {
  766. name: "Spec",
  767. value: g.specs,
  768. },
  769. {
  770. name: "Unit",
  771. value: g.unit,
  772. },
  773. {
  774. name: "BudgetPrice",
  775. value: g.priceInfo.tenderPrice,
  776. },
  777. {
  778. name: "NormPrice",
  779. value: g.priceInfo.basePrice,
  780. },
  781. {
  782. name: "IsAdd",
  783. value: g.unit_price.is_add,
  784. },
  785. ];
  786. Element.call(this, "Mech", attrs);
  787. let FixedCostItems = [];
  788. let fcsum = 0;
  789. let VariableCostItems = [];
  790. let vcsum = 0;
  791. if (g.ratio_data && g.ratio_data.length > 0) {
  792. for (let ratio of g.ratio_data) {
  793. let rIndex = gljUtil.getIndex(ratio);
  794. let rglj = gljKeyMap[rIndex];
  795. let ts = scMathUtil.roundForObj(parseFloat(ratio.consumption) * rglj.priceInfo.tenderPrice, decimalObj.glj.unitPrice);
  796. if (FixedCostMap[ratio.name]) {
  797. FixedCostItems.push(new FixedCostItem(ratio));
  798. fcsum = scMathUtil.roundForObj(fcsum + ts, decimalObj.glj.unitPrice);
  799. } else {
  800. VariableCostItems.push(new VariableCostItem(ratio));
  801. vcsum = scMathUtil.roundForObj(vcsum + ts, decimalObj.glj.unitPrice);
  802. }
  803. }
  804. }
  805. if (FixedCostItems.length > 0) {
  806. let fc = new FixedCost(fcsum);
  807. fc.children = FixedCostItems;
  808. this.children.push(fc);
  809. }
  810. if (VariableCostItems.length > 0) {
  811. let vc = new VariableCost(vcsum);
  812. vc.children = VariableCostItems;
  813. this.children.push(vc);
  814. }
  815. function VariableCost(sum) {
  816. const attrs = [{
  817. name: "VariableCostSum",
  818. value: sum,
  819. }];
  820. Element.call(this, "VariableCost", attrs);
  821. }
  822. function VariableCostItem(item) {
  823. const attrs = [{
  824. name: "VariableCostNo",
  825. value: item.code,
  826. },{
  827. name: "Consumption",
  828. value: item.consumption,
  829. }]
  830. Element.call(this, "VariableCostItem", attrs);
  831. }
  832. function FixedCost(sum) {
  833. const attrs = [{
  834. name: "FixedCostSum",
  835. value: sum,
  836. }, {
  837. name: "FixedRate",
  838. value: 1,
  839. }];
  840. Element.call(this, "FixedCost", attrs);
  841. }
  842. function FixedCostItem(item) {
  843. const attrs = [{
  844. name: "FixedCostNo",
  845. value: ratioCodeMap[item.code],
  846. },{
  847. name: "Sum",
  848. value: item.consumption,
  849. }]
  850. Element.call(this, "FixedCostItem", attrs);
  851. }
  852. }
  853. let Mps = new emptyElement("Mps");
  854. Mps.attrs = [{
  855. name: "KeyId",
  856. value: uuid.v1()
  857. }];
  858. let Materials = new emptyElement("Materials");
  859. Materials.attrs = [{
  860. name: "KeyId",
  861. value: uuid.v1()
  862. }];
  863. let Mechs = new emptyElement("Mechs");
  864. Mechs.attrs = [{
  865. name: "KeyId",
  866. value: uuid.v1()
  867. }];
  868. let gljKeyMap = {};
  869. let temMechs = [];
  870. if (isBidSubmission || isControl) { //导出到招标文件中,不输出这一部分。
  871. for (let g of pgljData.gljList) {
  872. if (!g.quantity) {
  873. continue;
  874. }
  875. let type = g.type + "";
  876. gljKeyMap[gljUtil.getIndex(g)] = g;
  877. type = type.charAt(0);
  878. if (type == "1") {
  879. Mps.children.push(new Mp(g));
  880. } else if (type == "2" || type == 5) {
  881. Materials.children.push(new Material(g));
  882. } else if (type == "3") {
  883. temMechs.push(g);
  884. }
  885. }
  886. for (let t of temMechs) {
  887. Mechs.children.push(new Mech(t,gljKeyMap));
  888. }
  889. }
  890. this.children.push(Mps);
  891. this.children.push(Materials);
  892. this.children.push(Mechs);
  893. }
  894. function EprjInfo(tenderProject) {
  895. let bills = tenderProject.Bills.datas;
  896. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  897. let totalItem = null;
  898. let proItem = null; //暂列金额项
  899. let safeItem = null;
  900. let oneToSevenItem = null;
  901. for (let b of bills) {
  902. if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.TOTAL_COST) totalItem = b;
  903. if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.PROVISIONAL) proItem = b;
  904. if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.ONE_SEVEN_BILLS) oneToSevenItem = b;
  905. if(b.code == "102-3" && b.name=="安全生产费") safeItem = b;
  906. }
  907. const attrs = [{
  908. name: "Name",
  909. value: tenderProject.projectInfo.name,
  910. },
  911. {
  912. name: "Sums",
  913. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  914. },
  915. {
  916. name: "KeyId",
  917. value: uuid.v1()
  918. }
  919. ];
  920. //输出控制价、投标文件时,取调价后的标段总造价。
  921. //输出招标文件时,取0
  922. if (isBidInvitation) attrs[1].value = 0;
  923. Element.call(this, "EprjInfo", attrs);
  924. // this.children.push(new SummaryOfCost(totalItem, proItem,safeItem,oneToSevenItem,feature));
  925. this.children.push(new MakeInfo(tenderProject));
  926. this.children.push(new Params(tenderProject));
  927. this.children.push(new getBillsItems(tenderProject));
  928. // this.children.push(new getIndexs(tenderProject));
  929. // let bidEvaluationMainMaterials = getBidEvaluationMainMaterial(tenderProject);
  930. // if(bidEvaluationMainMaterials.length > 0) this.children.push(...bidEvaluationMainMaterials);
  931. }
  932. function _getZeroValueIfNotValid(orgVal) {
  933. let rst = orgVal;
  934. if (orgVal === undefined || orgVal === null || orgVal === "") {
  935. rst = 0;
  936. }
  937. return rst;
  938. }
  939. function _getNumValueByExportKind(orgSum) {
  940. let rst = orgSum;
  941. // const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
  942. // const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
  943. // const isControl = exportKind === CONTROL; // 是否是控制价
  944. //根据导出类型(上面3个),输出实际合计或price
  945. if (isBidInvitation) {
  946. rst = 0;
  947. }
  948. return rst;
  949. }
  950. function _getStrValueByExportKind(orgStr) {
  951. let rst = orgStr;
  952. if (isBidInvitation) {
  953. rst = '';
  954. }
  955. return rst;
  956. }
  957. function getBidEvaluationMainMaterial(tenderProject) {
  958. let bidMaterials = [];
  959. let i = 1;
  960. for (let b of tenderProject.bidMaterialData) {
  961. bidMaterials.push(new BidEvaluationMainMaterial(b, i));
  962. i++
  963. }
  964. return bidMaterials;
  965. function BidEvaluationMainMaterial(b, index) {
  966. const attrs = [{
  967. name: "Code",
  968. value: b.seq,
  969. },
  970. {
  971. name: "Number",
  972. value: b.code
  973. },
  974. {
  975. name: "Name",
  976. value: b.name
  977. },
  978. {
  979. name: "Specification",
  980. value: b.specs
  981. },
  982. {
  983. name: "Unit",
  984. value: b.unit
  985. },
  986. {
  987. name: "Price",
  988. value: b.marketPrice || '0',
  989. type: TYPE.DECIMAL
  990. },
  991. {
  992. name: "LimitedPrice",
  993. value: b.marketPrice || '0',
  994. type: TYPE.DECIMAL
  995. },
  996. {
  997. name: "Quantity",
  998. value: 0,//b.quantity
  999. type: TYPE.DECIMAL
  1000. },
  1001. {
  1002. name: "Total",
  1003. value: 0//b.totalPrice
  1004. },
  1005. {
  1006. name: "Remark",
  1007. value: b.remark
  1008. }
  1009. ];
  1010. if (isBidSubmission || isControl) {
  1011. attrs[7].value = b.quantity;
  1012. attrs[8].value = b.totalPrice;
  1013. }
  1014. Element.call(this, "BidEvaluationMainMaterial", attrs);
  1015. }
  1016. }
  1017. function getIndexs(tenderProject) {
  1018. let Indexs = new emptyElement('Indexs');
  1019. Indexs.attrs = [{
  1020. name: "KeyId",
  1021. value: uuid.v1()
  1022. }];
  1023. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  1024. for (let f of feature) {
  1025. if (f.code) Indexs.children.push(new IndexItem(f))
  1026. }
  1027. return Indexs;
  1028. function IndexItem(fea) {
  1029. const attrs = [{
  1030. name: "Code",
  1031. value: fea.code,
  1032. },
  1033. {
  1034. name: "Name",
  1035. value: fea.dispName,
  1036. },
  1037. {
  1038. name: "Unit",
  1039. value: fea.unit,
  1040. },
  1041. {
  1042. name: "Value",
  1043. value: fea.value,
  1044. },
  1045. {
  1046. name: "Remark",
  1047. value: fea.remark,
  1048. },
  1049. {
  1050. name: "KeyId",
  1051. value: uuid.v1()
  1052. }
  1053. ]
  1054. Element.call(this, "IndexItem", attrs);
  1055. }
  1056. }
  1057. function getBillsItems(tenderProject) {
  1058. let items = new emptyElement("Items");
  1059. items.attrs =[{
  1060. name: "KeyId",
  1061. value: uuid.v1()
  1062. }];
  1063. let rootNodes = tenderProject.mainTree.roots;
  1064. for (let r of rootNodes) {
  1065. setItem(r, -1, items.children);
  1066. }
  1067. return items;
  1068. function setItem(bNode, level, list) {
  1069. if (bNode.sourceType == ModuleNames.ration) return;
  1070. let item = new bill(bNode, level);
  1071. if (bNode.children && bNode.children.length > 0) {
  1072. level += 1;
  1073. for (let c of bNode.children) {
  1074. setItem(c, level, item.children);
  1075. }
  1076. }
  1077. list.push(item);
  1078. function getCalcType(node) {
  1079. /*
  1080. 判断是否父项:
  1081. 是父项,则取1;
  1082. 是叶子项,则判断其下有无套定额/量价/工料机:
  1083. 有则取1;
  1084. 无则判断有无基数计算:
  1085. 有则取2;
  1086. 无则取3 */
  1087. if (node.children && node.children.length > 0) {
  1088. return 1; //是父项,则取1, 有套定额/量价/工料机,也取1
  1089. } else {
  1090. return node.data.calcBase && node.data.calcBase != "" ? 2 : 3
  1091. }
  1092. }
  1093. function getItemType(node) {
  1094. let Bills = projectObj.project.Bills;
  1095. //是100~900章部分、或是计日工部分,叶子清单输出1,父项输出0;
  1096. if (Bills.isBelongOneToSeven(node)||Bills.isBelongDayWork(node)) {
  1097. if (node.children && node.children.length > 0) {
  1098. return node.children[0].sourceType == ModuleNames.ration ? 1 : 0
  1099. }
  1100. return 1 //叶子清单输出1
  1101. } else {
  1102. return 0;
  1103. /* //非100~900章部分,
  1104. // 是暂列金额,判断暂列金额的金额等于0,则输出为0;暂列金额的金额不等于0,则输出为1;
  1105. if (node.data.name && node.data.name.indexOf("暂列金额") != -1) {
  1106. let sum = node.data.feesIndex && node.data.feesIndex.common ? node.data.feesIndex.common.tenderTotalFee : "";
  1107. return gljUtil.isNotEmpty(sum) ? 1 : 0
  1108. } else { //非暂列金额,则判断清单的工程量是否等于0,等于0,则输出0;不等于0,则输出1
  1109. return gljUtil.isNotEmpty(node.data.quantity) ? 1 : 0
  1110. } */
  1111. }
  1112. }
  1113. function bill(bNode, level) {
  1114. let data = bNode.data;
  1115. let CostKind = 3;
  1116. if (data.name && data.name.indexOf("安全生产费") != -1) CostKind = 1;
  1117. if (data.name && data.name.indexOf("暂列金额") != -1) CostKind = 2;
  1118. //1 = 工程量×综合单价;2 = 计算基数×费率;3 = 工程量×单价。
  1119. let CalcType = getCalcType(bNode);
  1120. //取暂估价类型。读取造价书界面的专项暂定列。0=材料暂估价,1=工程设备暂估价,2=专业工程暂估价,没有选的输出为空。
  1121. let ProvisionalType = "";
  1122. if (data.specialProvisional == "材料暂估") ProvisionalType = 0;
  1123. if (data.specialProvisional == "工程设备") ProvisionalType = 1;
  1124. if (data.specialProvisional == "专业工程") ProvisionalType = 2;
  1125. //MpRatio
  1126. let MpRatio = "";
  1127. let MaterialRatio = "";
  1128. let MechRatio = "";
  1129. if (data.quantityCoe) {
  1130. if (data.quantityCoe["labour"]) MpRatio = data.quantityCoe["labour"];
  1131. if (data.quantityCoe["material"]) MaterialRatio = data.quantityCoe["material"];
  1132. if (data.quantityCoe["machine"]) MechRatio = data.quantityCoe["machine"];
  1133. }
  1134. let fail = billNameChecking(bNode,tenderProject.projectInfo.name,fixedFlag)
  1135. //fail: { hint: '错误提示', type: '提示所属(基本就是单位工程名称)' }
  1136. let ListCode = "";
  1137. if (ListCodeMap[data.name]) ListCode = ListCodeMap[data.name][0];
  1138. if (data.code && data.code != "") ListCode = data.code;
  1139. let formulaCode = "";
  1140. if (ListCodeMap[data.name]) formulaCode = ListCodeMap[data.name][1];
  1141. let perKeyId = '';
  1142. if (data.ParentID != -1) perKeyId = data.ParentID;
  1143. const attrs = [{
  1144. name: "ListCode",
  1145. value: ListCode,
  1146. },
  1147. {
  1148. name: "ListName",
  1149. value: data.name,
  1150. fail:fail
  1151. },
  1152. {
  1153. name: "Unit",
  1154. value: data.unit,
  1155. },
  1156. {
  1157. name: "Num",
  1158. value: data.quantity,
  1159. type: TYPE.DECIMAL,
  1160. toFix:3
  1161. },
  1162. // {
  1163. // name: "QtyFormula",
  1164. // value: _getStrValueByExportKind(data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : ""),
  1165. // type: TYPE.DECIMAL,
  1166. // toFix:2
  1167. // },
  1168. {
  1169. name: "Price",
  1170. value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "",
  1171. type: TYPE.DECIMAL,
  1172. toFix:2
  1173. },
  1174. {
  1175. name: "Sum",
  1176. value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",
  1177. type: TYPE.DECIMAL,
  1178. toFix:2
  1179. },
  1180. {
  1181. name: "ProvisionalType",
  1182. value: ProvisionalType,
  1183. mustHasValue:true
  1184. },
  1185. {
  1186. name: "MeterRules",
  1187. value: "",
  1188. },
  1189. {
  1190. name: "Content",
  1191. value: data.jobContentText,
  1192. },
  1193. {
  1194. name: "Remarks",
  1195. value: data.remark,
  1196. },
  1197. {
  1198. name: "ItemType",
  1199. value: getItemType(bNode),
  1200. },
  1201. {
  1202. name: "FormulaCode",
  1203. value: formulaCode
  1204. },
  1205. {
  1206. name: "KeyId",
  1207. value: data.ID
  1208. },
  1209. {
  1210. name: "PerKeyId",
  1211. value: perKeyId
  1212. }
  1213. ];
  1214. //投标、招标控制价时。取单价。
  1215. //招标时,如果是“安全生产费”或“暂列金额”,取单价,否则取0。
  1216. if (isBidSubmission || isControl || CostKind==1 ||CostKind==2) {
  1217. attrs[4].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "";
  1218. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1219. //暂列金额 数量为0的时候,单价输出0
  1220. if( CostKind==2 && !gljUtil.isNotEmpty(data.quantity)) attrs[4].value = 0
  1221. }
  1222. // 计日工合计下的劳务、材料、机械Item节点单价及合价(Price, Sum)也要输出
  1223. if (bNode.children && bNode.children.length === 0 && bNode.data.quantity) { //先检测是否有费用
  1224. // 再检测是否计日工合计清单下
  1225. if (_chkIfJRGHJ(bNode, ['计日工合计'])) {
  1226. attrs[4].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "";
  1227. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1228. }
  1229. }
  1230. // 清单的专项暂定有选择了专业工程的清单Item节点单价及合价(Price, Sum)也要输出
  1231. if (ProvisionalType === 2) {
  1232. attrs[4].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "";
  1233. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1234. }
  1235. //特殊清单
  1236. const specialBills = ['计日工合计', '已包含在清单合计中的材料、工程设备、专业工程暂估价合计'];
  1237. if (bNode.children && bNode.children.length > 0 && _chkIfJRGHJ(bNode, specialBills)) {
  1238. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1239. }
  1240. Element.call(this, "Item", attrs);
  1241. let cc = CostComposition(bNode);
  1242. if (cc) this.children.push(cc);
  1243. this.children.push(CostStructure(data))
  1244. // function _chkIfHas
  1245. function _chkIfJRGHJ(bNode, exArr = []) {
  1246. //检测是否在指定清单的子目录下(如:计日工合计等)
  1247. let rst = false;
  1248. let pNode = bNode;
  1249. while (pNode !== null && pNode !== undefined) {
  1250. if ((typeof pNode.name === 'string') && exArr.includes(pNode.name)) {
  1251. rst = true;
  1252. break;
  1253. }
  1254. pNode = pNode.parent;
  1255. }
  1256. return rst;
  1257. }
  1258. function _chkIfNeedCostComposition(bNode) {
  1259. let rst = isBidInvitation && !(ProvisionalType === 0 || ProvisionalType === 1);
  1260. if (!rst) {
  1261. //计日工合计下的劳务、材料、机械 有费用也要输出
  1262. if (bNode.children && bNode.children.length === 0 && bNode.data.quantity) { //先检测是否有费用
  1263. // 再检测是否计日工合计清单下
  1264. rst = _chkIfJRGHJ(bNode, ['计日工合计']);
  1265. }
  1266. }
  1267. return rst;
  1268. }
  1269. function CostComposition(bNode) {
  1270. if (_chkIfNeedCostComposition(bNode)) return null;
  1271. let CostComposition = new emptyElement('CostComposition');
  1272. CostComposition.attrs =[{
  1273. name: "KeyId",
  1274. value: uuid.v1()
  1275. }];
  1276. let Norms = [];
  1277. let Costs = [];
  1278. if (bNode.children && bNode.children.length > 0 && bNode.children[0].sourceType == ModuleNames.ration) {
  1279. for (let r of bNode.children) {
  1280. if (r.data.type == rationType.ration) {
  1281. if(isEmptyRation(r.data)) continue;//定额空行不输出到接口文件中。
  1282. Norms.push(new Ration(r.data));
  1283. } else {
  1284. Costs.push(new Cost(r.data));
  1285. }
  1286. }
  1287. }
  1288. if (Norms.length > 0) CostComposition.children.push(...Norms);
  1289. if (Costs.length > 0) CostComposition.children.push(...Costs);
  1290. if (bNode.data.calcBase) CostComposition.children.push(new Formula(bNode.data));
  1291. return CostComposition.children.length > 0 ? CostComposition : null;
  1292. //定额空行不输出到接口文件中。 //定额空行的判断是:定额编码、定额名称、定额单位、定额单位、定额工程量为零或为空时
  1293. function isEmptyRation(ration){
  1294. return !gljUtil.isNotEmpty(ration.code)&&!gljUtil.isNotEmpty(ration.name)&&!gljUtil.isNotEmpty(ration.unit)&&(!gljUtil.isNotEmpty(ration.quantity)||ration.quantity == 0)
  1295. }
  1296. function Formula(bills) {
  1297. const attrs = [{
  1298. name: "Name",
  1299. value: bills.name
  1300. },
  1301. {
  1302. name: "Formulas",
  1303. value: bills.calcBase
  1304. },
  1305. {
  1306. name: "Ratio",
  1307. value: 1
  1308. },
  1309. {
  1310. name: "Sum",
  1311. value: bills.feesIndex && bills.feesIndex.common ? bills.feesIndex.common.tenderTotalFee : "",
  1312. type:TYPE.DECIMAL
  1313. },
  1314. {
  1315. name: "Remarks",
  1316. value: bills.remark
  1317. },
  1318. {
  1319. name: "KeyId",
  1320. value: uuid.v1()
  1321. }
  1322. ]
  1323. Element.call(this, "Formula", attrs);
  1324. // 1.Name
  1325. // 名称/描述。取清单的名称。
  1326. // 2.Formulas
  1327. // 计算式。读取计算基数的文本。
  1328. // 取基数计算窗口内容,基数直接转换为金额?参考标准文档的 7.11 及 7.12 节。
  1329. // 7.11是定额的费用,7.12是清单累进基数,主要是估概预算中用到,清单里的不同,所以中山的接口直接输出基数文本。
  1330. // 3.Ratio
  1331. // 系数。输出为1,非必填。
  1332. // 4.Sum
  1333. // 取金额。
  1334. // 5.Remarks
  1335. }
  1336. function Cost(item) {
  1337. let BasePrice = 0;
  1338. if (item.type == rationType.volumePrice) { // 当插入的是量价时,基价读取单价列。
  1339. BasePrice = item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
  1340. } else {
  1341. BasePrice = getBasePrice(item.projectGLJID, tenderProject)
  1342. }
  1343. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  1344. let CostTypeNo = '';
  1345. if (feeRateMap[calcMap[item.programID]]) CostTypeNo = feeRateMap[calcMap[item.programID]];
  1346. const attrs = [{
  1347. name: "Code",
  1348. value: item.code,
  1349. }, {
  1350. name: 'Name',
  1351. value: item.name
  1352. }, {
  1353. name: 'Spec',
  1354. value: item.specs
  1355. }, {
  1356. name: 'Unit',
  1357. value: item.unit
  1358. }, {
  1359. name: 'Num',
  1360. value: item.tenderQuantity
  1361. }, {
  1362. name: 'BasePrice',
  1363. value: BasePrice
  1364. }, {
  1365. name: 'Price',
  1366. value: item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
  1367. }, {
  1368. name: 'IsEquipment',
  1369. value: item.subType == gljType.EQUIPMENT ? 1 : 0
  1370. }, {
  1371. name: 'CostTypeNo',
  1372. value: CostTypeNo
  1373. }, {
  1374. name: 'ProfitRate',
  1375. value: getFeeRate(item.programID, 'profit', tenderProject)
  1376. },
  1377. {
  1378. name: 'TaxRate',
  1379. value: getFeeRate(item.programID, 'tax', tenderProject)
  1380. },
  1381. {
  1382. name: 'MpRatio',
  1383. value: item.subType == gljType.LABOUR ? 100 : 0
  1384. },
  1385. {
  1386. name: 'MaterialRatio',
  1387. value: item.subType == gljType.GENERAL_MATERIAL ? 100 : 0
  1388. },
  1389. {
  1390. name: 'MechRatio',
  1391. value: item.subType == gljType.GENERAL_MACHINE ? 100 : 0
  1392. },
  1393. {
  1394. name: "KeyId",
  1395. value: uuid.v1()
  1396. }
  1397. ]
  1398. Element.call(this, "Cost", attrs);
  1399. this.children.push(CostStructure(item));
  1400. }
  1401. function Ration(ration) {
  1402. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  1403. let CostTypeNo = '';
  1404. if (feeRateMap[calcMap[ration.programID]]) CostTypeNo = feeRateMap[calcMap[ration.programID]];
  1405. const attrs = [{
  1406. name: "NormLibNo",
  1407. value: 'YSDE-000000-2018-86',
  1408. }, {
  1409. name: 'DisplayCode',
  1410. value: ration.code
  1411. }, {
  1412. name: 'Name',
  1413. value: ration.name
  1414. }, {
  1415. name: 'Unit',
  1416. value: ration.unit
  1417. }, {
  1418. name: 'Num',
  1419. value: ration.tenderQuantity
  1420. },
  1421. {
  1422. name: 'CostTypeNo',
  1423. value: CostTypeNo
  1424. },
  1425. {
  1426. name: 'ProfitRate',
  1427. value: getFeeRate(ration.programID, 'profit', tenderProject) //tenderProject.ProfitRate
  1428. },
  1429. {
  1430. name: 'TaxRate',
  1431. value: getFeeRate(ration.programID, 'tax', tenderProject) //tenderProject.TaxRate
  1432. },
  1433. {
  1434. name: 'FabricationCost',
  1435. value: ration.feesIndex && ration.feesIndex.common ? ration.feesIndex.common.tenderTotalFee : 0
  1436. },
  1437. {
  1438. name: 'AdjustStatus',
  1439. value: ration.adjustState
  1440. }
  1441. ]
  1442. Element.call(this, "Norm", attrs);
  1443. this.children.push(CostStructure(ration));
  1444. this.children.push(Consume(ration));
  1445. }
  1446. }
  1447. function Consume(ration) {
  1448. let consume = new emptyElement('Consume');
  1449. for (let rg of ration.rationGLJList) {
  1450. consume.children.push(new ConsumeItem(rg));
  1451. }
  1452. return consume;
  1453. function ConsumeItem(rg) {
  1454. const attrs = [{
  1455. name: "Code",
  1456. value: rg.code,
  1457. }, {
  1458. name: "Consumption",
  1459. value: rg.tenderQuantity
  1460. }];
  1461. Element.call(this, "ConsumeItem", attrs);
  1462. }
  1463. }
  1464. function CostStructure(item) {
  1465. let CostStructure = new emptyElement('CostStructure');
  1466. CostStructure.attrs = [{
  1467. name: "KeyId",
  1468. value: uuid.v1()
  1469. }];
  1470. for (let f of cpFeeTypes) {
  1471. if(itemFeeMap[f.type]) CostStructure.children.push(new CostItem(item,f.type))
  1472. }
  1473. if (CostStructure.children.length == 0) CostStructure.children.push(new CostItem({},""))
  1474. function CostItem(item,type) {
  1475. const attrs = [{
  1476. name: "ItemNo",
  1477. value: itemFeeMap[type],
  1478. }, {
  1479. name: 'Sum',
  1480. value: 0 //fee.tenderTotalFee
  1481. }, {
  1482. name: "KeyId",
  1483. value: uuid.v1()
  1484. }
  1485. ]
  1486. if ((isBidSubmission || isControl) && item.feesIndex && item.feesIndex[type]) attrs[1].value = item.feesIndex[type].tenderTotalFee;
  1487. Element.call(this, "CostItem", attrs);
  1488. }
  1489. return CostStructure;
  1490. }
  1491. }
  1492. }
  1493. }
  1494. function Params(tenderProject) {
  1495. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  1496. let featrueMap = {};
  1497. let baseMap = {};
  1498. for (let f of feature) {
  1499. featrueMap[f.key] = f;
  1500. }
  1501. let baseInfo = _.find(tenderProject.property.basicInformation, {
  1502. dispName: "基本信息",
  1503. });
  1504. for (let i of baseInfo.items) {
  1505. let key = i.key;
  1506. //if (i.dispName == "编制日期") key = "编制时间";
  1507. baseMap[key] = i;
  1508. }
  1509. let BuildType = "";
  1510. if (baseMap["natureConstruction"].value == "新建") BuildType = 0;
  1511. if (baseMap["natureConstruction"].value == "改扩建") BuildType = 1;
  1512. let Terrain = "";
  1513. if (baseMap["terrainCategory"].value == "平原微丘") Terrain = 0;
  1514. if (baseMap["terrainCategory"].value == "山岭重丘") Terrain = 1;
  1515. let DesignSpeed = parseFloat(featrueMap["designSpeed"].value);
  1516. if (isNaN(DesignSpeed)) DesignSpeed = 0;
  1517. let Structure = 0;
  1518. if (featrueMap["pavementStructure"].value == "沥青路面") Structure = 0;
  1519. if (featrueMap["pavementStructure"].value == "水泥混凝土路面") Structure = 1;
  1520. if (featrueMap["pavementStructure"].value == "其他类型路面") Structure = 2;
  1521. let RoadGrade = "";
  1522. if (RoadGradeMap[baseMap["roadGrade"].value]) RoadGrade = RoadGradeMap[baseMap["roadGrade"].value];
  1523. const attrs = [{
  1524. name: "PrjArea",
  1525. value: baseMap["location"] ? baseMap["location"].value : ""
  1526. },
  1527. {
  1528. name: "StartPileNo",
  1529. value: baseMap["startChainages"] ? baseMap["startChainages"].value : "",
  1530. mustHasValue: true
  1531. },
  1532. {
  1533. name: "EndPileNo",
  1534. value: baseMap["endChainages"] ? baseMap["endChainages"].value : "",
  1535. mustHasValue: true
  1536. },
  1537. {
  1538. name: "BuildType",
  1539. value: BuildType,
  1540. },
  1541. {
  1542. name: "Terrain",
  1543. value: Terrain,
  1544. mustHasValue: true
  1545. },
  1546. {
  1547. name: "RoadGrade",
  1548. value: RoadGrade,
  1549. mustHasValue: true
  1550. },
  1551. {
  1552. name: "DesignSpeed",
  1553. value: DesignSpeed
  1554. },
  1555. {
  1556. name: "Structure",
  1557. value: Structure
  1558. },
  1559. {
  1560. name: "SubgradeWidth",
  1561. value: featrueMap["subgradeWidth"] ? _getZeroValueIfNotValid(featrueMap["subgradeWidth"].value) : 0
  1562. },
  1563. {
  1564. name: "RoadLength",
  1565. value: featrueMap["roadLength"] ? _getZeroValueIfNotValid(featrueMap["roadLength"].value) : 0
  1566. },
  1567. {
  1568. name: "BridgeLength",
  1569. value: featrueMap["bridgeLength"] ? _getZeroValueIfNotValid(featrueMap["bridgeLength"].value) : 0
  1570. },
  1571. {
  1572. name: "TunnelLength",
  1573. value: featrueMap["tunnelLength"] ? _getZeroValueIfNotValid(featrueMap["tunnelLength"].value) : 0
  1574. },
  1575. {
  1576. name: "BriTunRate",
  1577. value: featrueMap["briTunRate"] ? _getZeroValueIfNotValid(featrueMap["briTunRate"].value) : 0
  1578. },
  1579. {
  1580. name: "InterchangeNum",
  1581. value: featrueMap["interchangeNum"] ? _getZeroValueIfNotValid(featrueMap["interchangeNum"].value) : 0
  1582. },
  1583. {
  1584. name: "RisingRate",
  1585. value: 0,
  1586. mustHasValue: true
  1587. },
  1588. {
  1589. name: "RisingYears",
  1590. value: 0,
  1591. mustHasValue: true
  1592. },
  1593. {
  1594. name: "RateNo",
  1595. value: uuid.v1()
  1596. },
  1597. {
  1598. name: "PractNo",
  1599. value: uuid.v1()
  1600. },
  1601. {
  1602. name: "StubLengths",
  1603. value: featrueMap["stubLengths"] ? _getZeroValueIfNotValid(featrueMap["stubLengths"].value) : 0
  1604. },
  1605. {
  1606. name: "LaneLength",
  1607. value: featrueMap["laneLength"] ? _getZeroValueIfNotValid(featrueMap["laneLength"].value) : 0
  1608. },
  1609. {
  1610. name: "KeyId",
  1611. value: uuid.v1()
  1612. }
  1613. ];
  1614. Element.call(this, "Params", attrs);
  1615. }
  1616. function SummaryOfCost(totalItem, proItem,safeItem,oneToSevenItem,feature) {
  1617. let attrs = [{
  1618. name: "TenderSumLimit",
  1619. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1620. type: TYPE.DECIMAL,
  1621. toFix:2,
  1622. },
  1623. {
  1624. name: "BidTotal",
  1625. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1626. type: TYPE.DECIMAL,
  1627. toFix:2,
  1628. },
  1629. {
  1630. name: "BillTotal",
  1631. value: oneToSevenItem.feesIndex && oneToSevenItem.feesIndex.common && oneToSevenItem.feesIndex.common.tenderTotalFee ? oneToSevenItem.feesIndex.common.tenderTotalFee : 0,
  1632. type: TYPE.DECIMAL,
  1633. toFix:2,
  1634. },
  1635. {
  1636. name: "CostForHSE",
  1637. value: safeItem && safeItem.feesIndex && safeItem.feesIndex.common && safeItem.feesIndex.common.tenderTotalFee ? safeItem.feesIndex.common.tenderTotalFee : 0,
  1638. type: TYPE.DECIMAL,
  1639. toFix:2,
  1640. },
  1641. {
  1642. name: "ProvisionalSums",
  1643. value: proItem.feesIndex && proItem.feesIndex.common && proItem.feesIndex.common.tenderTotalFee ? proItem.feesIndex.common.tenderTotalFee : 0,
  1644. type: TYPE.DECIMAL,
  1645. toFix:2,
  1646. },
  1647. {
  1648. name: "Appraisal",
  1649. value: totalItem.feesIndex && totalItem.feesIndex.estimate && totalItem.feesIndex.estimate.tenderTotalFee ? totalItem.feesIndex.estimate.tenderTotalFee : 0,
  1650. type: TYPE.DECIMAL,
  1651. toFix:2,
  1652. },
  1653. ];
  1654. if (isBidInvitation) {
  1655. attrs.splice(0, 3) //招标
  1656. }
  1657. //if (isControl) attrs.splice(1, 5); //控制价
  1658. if (isBidSubmission) { //投标文件时,读工程特征中的 招标控制价 值
  1659. let tenderSumLimit = _.find(feature, { "key": "tenderSumLimit" });
  1660. if(tenderSumLimit) attrs[0].value = tenderSumLimit.value
  1661. }
  1662. Element.call(this, "SummaryOfCost", attrs);
  1663. }
  1664. function MakeInfo(tenderProject) {
  1665. let property = tenderProject.property;
  1666. let baseMap = {};
  1667. let baseInfo = _.find(property.basicInformation, {
  1668. dispName: "基本信息",
  1669. });
  1670. for (let i of baseInfo.items) {
  1671. let key = i.key;
  1672. //if (i.dispName == "编制日期") key = "编制时间";
  1673. baseMap[key] = i;
  1674. }
  1675. //mustHasValue
  1676. const attrs = [
  1677. // {
  1678. // name: "ValuationModel",
  1679. // value: property.taxType,
  1680. // },
  1681. {
  1682. name: "Manage",
  1683. value: baseMap["constructingUnit"] ? baseMap["constructingUnit"].value : "",
  1684. },
  1685. {
  1686. name: "Designer",
  1687. value: baseMap["designUnit"] ? baseMap["designUnit"].value : ""
  1688. },
  1689. {
  1690. name: "Compile",
  1691. value: baseMap["compileUnit"] ? baseMap["compileUnit"].value : "",
  1692. },
  1693. {
  1694. name: "CompileApprover",
  1695. value: baseMap["compileApprover"] ? baseMap["compileApprover"].value : "",
  1696. },
  1697. {
  1698. name: "CompileCertNo",
  1699. value: baseMap["compileCertNo"] ? baseMap["compileCertNo"].value : ""
  1700. },
  1701. {
  1702. name: "CompileDate",
  1703. value: baseMap["compileDate"] && baseMap["compileDate"].value != "" ? baseMap["compileDate"].value + "T00:00:00" : ""
  1704. },
  1705. {
  1706. name: "Review",
  1707. value: baseMap["reviewUnit"] ? baseMap["reviewUnit"].value : ""
  1708. },
  1709. {
  1710. name: "ReviewApprover",
  1711. value: baseMap["reviewApprover"] ? baseMap["reviewApprover"].value : ""
  1712. },
  1713. {
  1714. name: "ReviewCertNo",
  1715. value: baseMap["reviewCertNo"] ? baseMap["reviewCertNo"].value : ""
  1716. },
  1717. {
  1718. name: "ReviewDate",
  1719. value: baseMap["reviewDate"] && baseMap["reviewDate"].value != "" ? baseMap["reviewDate"].value + "T00:00:00" : ""
  1720. },
  1721. {
  1722. name: "Examine",
  1723. value: baseMap["examineUnit"] ? baseMap["examineUnit"].value : "",
  1724. mustHasValue:true
  1725. },
  1726. {
  1727. name: "ExamineApprover",
  1728. value: baseMap["examineApprover"] ? baseMap["examineApprover"].value : "",
  1729. mustHasValue:true
  1730. },
  1731. {
  1732. name: "ExamineCertNo",
  1733. value: baseMap["examineCertNo"] ? baseMap["examineCertNo"].value : "",
  1734. mustHasValue:true
  1735. },
  1736. {
  1737. name: "ExamineDate",
  1738. value: baseMap["examineDate"] && baseMap["examineDate"].value != "" ? baseMap["examineDate"].value + "T00:00:00" : "",
  1739. mustHasValue:true
  1740. },
  1741. {
  1742. name: "CompileExplain",
  1743. value: baseMap["compileExplain"] ? baseMap["compileExplain"].value : "",
  1744. mustHasValue:true
  1745. },
  1746. {
  1747. name: "ExamineExplain",
  1748. value: baseMap["examineExplain"] ? baseMap["examineExplain"].value : "",
  1749. mustHasValue:true
  1750. },
  1751. {
  1752. name: "ProjectExplain",
  1753. value: baseMap["projectExplain"] ? baseMap["projectExplain"].value : "",
  1754. mustHasValue:true
  1755. },
  1756. {
  1757. name: "KeyId",
  1758. value: uuid.v1()
  1759. }
  1760. ];
  1761. if (isBidInvitation) { //招标文件,则以下的8、12~18则不输出
  1762. // attrs.splice(11, 7);
  1763. // attrs.splice(7, 1);
  1764. }
  1765. Element.call(this, "MakeInfo", attrs);
  1766. }
  1767. let data = new CprjInfo(projectData.name);
  1768. data.children.push(new SystemInfo(projectData));
  1769. data.children.push(new CostBasis());
  1770. let seriNo = 1;
  1771. let Rates = [];
  1772. let Practs = [];
  1773. let EprjInfos = [];
  1774. let Indexs = [];
  1775. for (let c of projectData.children) {
  1776. let tenderProject = tenderDetailMap[c.ID];
  1777. let feeRataDatas = tenderProject.FeeRate.datas;
  1778. Rates.push(new Rate(tenderProject, feeRataDatas, seriNo));
  1779. Practs.push(new Pract(tenderProject, seriNo));
  1780. EprjInfos.push(new EprjInfo(tenderProject));
  1781. Indexs.push(new getIndexs(tenderProject));
  1782. seriNo++;
  1783. }
  1784. data.children.push(...Rates,...Practs,...EprjInfos,...Indexs);
  1785. return [{
  1786. data: data,
  1787. exportKind: exportKind,
  1788. fileName: projectData.name + INTERFACE_CONFIG[areaKey]["fileSuffix"][exportKind],
  1789. }, ];
  1790. }
  1791. return {
  1792. entry,
  1793. };
  1794. })();