guangxi_common.js 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852
  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. Element.call(this, "NormLib", attrs);
  383. }
  384. this.children.push(new NormLib());
  385. }
  386. function Rate(tenderProject, feeRateInfo, seirNo) {
  387. //RateNo="1" Name="纵横软件测试版本" RateLibNo="GYSFL-000000-2018-86"
  388. const attrs = [{
  389. name: "RateNo",
  390. value: seirNo,
  391. },
  392. {
  393. name: "Name",
  394. value: feeRateInfo.name,
  395. },
  396. {
  397. name: "RateLibNo",
  398. value: feeLibNoMap[feeRateInfo.libID],
  399. },
  400. {
  401. name: "KeyId",
  402. value: uuid.v1()
  403. }
  404. ];
  405. Element.call(this, "Rate", attrs);
  406. let RateParams = new emptyElement("RateParams");
  407. RateParams.attrs = [{
  408. name: "KeyId",
  409. value: uuid.v1()
  410. }];
  411. let subRates = projectObj.project.FeeRate.getAllSubRates(feeRateInfo.rates);
  412. for (let s of subRates) {
  413. let sname = s.name.replace("(%)", "");
  414. sname = sname.replace("(%)", "");
  415. if (feeRateMap[sname]) {
  416. let value = "";
  417. if (s.editable) {
  418. let sel = _.find(s.optionList, {
  419. selected: true,
  420. });
  421. if (sel) {
  422. value = sel.name;
  423. } else if (gljUtil.isDef(s.value)) {
  424. value = s.value;
  425. }
  426. } else {
  427. value = _.findIndex(s.optionList, {
  428. selected: true,
  429. });
  430. if (value == -1) value = 0;
  431. }
  432. /* if (sname == '利润') tenderProject.ProfitRate = value;
  433. if (sname == '税金') tenderProject.TaxRate = value; */
  434. RateParams.children.push(new RateParam(feeRateMap[sname], value));
  435. }
  436. }
  437. this.children.push(RateParams);
  438. function RateParam(RateTypeNo, RateParamNo) {
  439. //<RateParam RateTypeNo="DJSGZJFFL" RateParamNo="0" Ratio="100"/>
  440. const attrs = [{
  441. name: "RateTypeNo",
  442. value: RateTypeNo,
  443. },
  444. {
  445. name: "RateParamNo",
  446. value: RateParamNo,
  447. },
  448. {
  449. name: "Ratio",
  450. value: "100",
  451. },
  452. ];
  453. Element.call(this, "RateParam", attrs);
  454. }
  455. let RateValues = new emptyElement("RateValues");
  456. RateValues.attrs = [{
  457. name: "KeyId",
  458. value: uuid.v1()
  459. }];
  460. function RateValue(CostTypeNo, RateTypeNo, value) {
  461. const attrs = [{
  462. name: "CostTypeNo",
  463. value: CostTypeNo,
  464. },
  465. {
  466. name: "RateTypeNo",
  467. value: RateTypeNo,
  468. },
  469. {
  470. name: "RateValue",
  471. value: value,
  472. },
  473. {
  474. name: "KeyId",
  475. value: uuid.v1()
  476. }
  477. ];
  478. Element.call(this, "RateValue", attrs);
  479. }
  480. let prefix = "";
  481. for (let r of feeRateInfo.rates) {
  482. if (!r.ParentID && feeRateMap[r.name]) prefix = feeRateMap[r.name];
  483. if (feeRateMap[r.name] && r.ParentID) {
  484. RateValues.children.push(new RateValue(prefix, feeRateMap[r.name], r.rate));
  485. }
  486. }
  487. this.children.push(RateValues);
  488. }
  489. function Pract(tpdata, seriNo) {
  490. let pgljData = tpdata.projectGLJ.datas;
  491. let decimalObj = tpdata.property.decimal;
  492. const attrs = [{
  493. name: "PractNo",
  494. value: seriNo,
  495. },
  496. {
  497. name: "Name",
  498. value: pgljData.constData.usedUnitPriceInfo.name,
  499. },
  500. {
  501. name: "KeyId",
  502. value: uuid.v1()
  503. }
  504. ];
  505. Element.call(this, "Pract", attrs);
  506. let Param = {
  507. name: "Param",
  508. attrs: [{
  509. name: "TaxLibNo",
  510. value: "CCSBZ-440000-2019-544",
  511. },
  512. {
  513. name: "AuxRate",
  514. value: pgljData.constData.assistProductionFeeRate,
  515. },
  516. ],
  517. children: [],
  518. };
  519. if (isBidSubmission || isControl) { //导出到招标文件中,不输出这一部分。
  520. let elecDatas = electrovalenceObj.getElectrovalenceDatas(null, pgljData.com_electrovalence, pgljData.gljList);
  521. electrovalenceObj.calcPertElectrovalenceMarketPrice(elecDatas);
  522. for (let e of elecDatas) {
  523. let Electro = {
  524. name: "Electro",
  525. attrs: [{
  526. name: "Code",
  527. value: e.code,
  528. },
  529. {
  530. name: "Price",
  531. value: e.electPrice,
  532. },
  533. {
  534. name: "Ratio",
  535. value: e.coe,
  536. },
  537. ],
  538. children: [],
  539. };
  540. Param.children.push(Electro);
  541. }
  542. }
  543. this.children.push(Param);
  544. function Mp(g) {
  545. const attrs = [{
  546. name: "Code",
  547. value: g.code,
  548. },
  549. {
  550. name: "PractName",
  551. value: g.name,
  552. },
  553. {
  554. name: "Spec",
  555. value: g.specs,
  556. },
  557. {
  558. name: "Unit",
  559. value: g.unit,
  560. },
  561. {
  562. name: "BudgetPrice",
  563. value: g.priceInfo.tenderPrice,
  564. },
  565. {
  566. name: "NormPrice",
  567. value: g.priceInfo.basePrice,
  568. },
  569. {
  570. name: "IsAdd",
  571. value: g.unit_price.is_add,
  572. },
  573. ];
  574. Element.call(this, "Mp", attrs);
  575. }
  576. function Material(g) {
  577. const attrs = [{
  578. name: "Code",
  579. value: g.code,
  580. },
  581. {
  582. name: "PractName",
  583. value: g.name,
  584. },
  585. {
  586. name: "Spec",
  587. value: g.specs,
  588. },
  589. {
  590. name: "Unit",
  591. value: g.unit,
  592. },
  593. {
  594. name: "BudgetPrice",
  595. value: g.priceInfo.tenderPrice,
  596. },
  597. {
  598. name: "NormPrice",
  599. value: g.priceInfo.basePrice,
  600. },
  601. {
  602. name: "IsAdd",
  603. value: g.unit_price.is_add,
  604. },
  605. {
  606. name: "OrgPrice",
  607. value: g.unit_price.originalPrice ? g.unit_price.originalPrice : 0,
  608. },
  609. {
  610. name: "TransFee",
  611. value: g.unit_price.unitFreight ? g.unit_price.unitFreight : 0,
  612. },
  613. {
  614. name: "GwRate",
  615. value: g.unit_price.grossWeightCoe_n ? g.unit_price.grossWeightCoe_n : 0,
  616. },
  617. {
  618. name: "OffSiteLf",
  619. value: g.unit_price.offSiteTransportLossRate_n ? g.unit_price.offSiteTransportLossRate_n : 0,
  620. },
  621. {
  622. name: "OnSiteLf",
  623. value: 0,
  624. },
  625. {
  626. name: "LoadLf",
  627. value: g.unit_price.handlingLossRate_n ? g.unit_price.handlingLossRate_n : 0,
  628. },
  629. {
  630. name: "StoreRate",
  631. value: g.unit_price.purchaseStorageRate_n ? g.unit_price.purchaseStorageRate_n : 0,
  632. },
  633. {
  634. name: "PackageRecycleFee",
  635. value: g.unit_price.packageRecoverValue ? g.unit_price.packageRecoverValue : 0,
  636. },
  637. ];
  638. Element.call(this, "Material", attrs);
  639. // if (g.unit_price.calcMaterial == 1) { //有材料计算
  640. // let index = gljUtil.getIndex(g);
  641. // let orList = [];
  642. // for (let o of pgljData.originalList) {
  643. // if (o.connect_key == index) orList.push(new OrgPrices(o));
  644. // }
  645. // if (orList.length > 0) this.children = orList;
  646. // }
  647. function CostStructure(r) {
  648. //待获取
  649. this.name = "CostStructure";
  650. this.attrs = [];
  651. this.children = [];
  652. }
  653. function Consume(r, o) {
  654. this.name = "Consume";
  655. this.attrs = [];
  656. this.children = [];
  657. for (let g of o.ration_gljs) {
  658. if (g.rationID == r.ID) {
  659. let r_quantity = scMathUtil.roundForObj(r.quantity, tpdata.property.decimal.ration.quantity);
  660. this.children.push(new ConsumeItem(g, r_quantity));
  661. }
  662. }
  663. }
  664. function ConsumeItem(g, ration_quantity) {
  665. const attrs = [{
  666. name: "Code", //待获取
  667. value: g.code,
  668. },
  669. {
  670. name: "Consumption",
  671. value: scMathUtil.roundForObj(ration_quantity * parseFloat(g.quantity), tpdata.property.decimal.glj.quantity),
  672. },
  673. ];
  674. Element.call(this, "ConsumeItem", attrs);
  675. }
  676. function Norm(r, o) {
  677. const attrs = [{
  678. name: "NormLibNo", //待获取
  679. value: "",
  680. },
  681. {
  682. name: "DisplayCode",
  683. value: r.code,
  684. },
  685. {
  686. name: "Name",
  687. value: r.name,
  688. },
  689. {
  690. name: "Unit",
  691. value: r.unit,
  692. },
  693. {
  694. name: "Num",
  695. value: r.quantity,
  696. },
  697. {
  698. name: "CostTypeNo",
  699. value: "", //待获取
  700. },
  701. {
  702. name: "FabricationCost", //待获取
  703. value: "",
  704. },
  705. {
  706. name: "AdjustStatus",
  707. value: "",
  708. },
  709. ];
  710. Element.call(this, "Norm", attrs);
  711. this.children.push(new CostStructure(r));
  712. this.children.push(new Consume(r, o));
  713. }
  714. function SelfCollect(o) {
  715. const attrs = [{
  716. name: "OtherCost",
  717. value: 0,
  718. }, ];
  719. Element.call(this, "SelfCollect", attrs);
  720. for (let r of o.rations) {
  721. this.children.push(new Norm(r, o));
  722. }
  723. }
  724. function OrgPrices(o) {
  725. const attrs = [{
  726. name: "OrgPricevalue",
  727. value: o.supplyPrice,
  728. },
  729. {
  730. name: "Ratio",
  731. value: o.coe,
  732. },
  733. ];
  734. Element.call(this, "OrgPrices", attrs);
  735. if (!o.rations) return;
  736. this.children.push(new SelfCollect(o));
  737. }
  738. }
  739. function Mech(g,gljKeyMap) {
  740. const attrs = [{
  741. name: "Code",
  742. value: g.code,
  743. },
  744. {
  745. name: "PractName",
  746. value: g.name,
  747. },
  748. {
  749. name: "Spec",
  750. value: g.specs,
  751. },
  752. {
  753. name: "Unit",
  754. value: g.unit,
  755. },
  756. {
  757. name: "BudgetPrice",
  758. value: g.priceInfo.tenderPrice,
  759. },
  760. {
  761. name: "NormPrice",
  762. value: g.priceInfo.basePrice,
  763. },
  764. {
  765. name: "IsAdd",
  766. value: g.unit_price.is_add,
  767. },
  768. ];
  769. Element.call(this, "Mech", attrs);
  770. let FixedCostItems = [];
  771. let fcsum = 0;
  772. let VariableCostItems = [];
  773. let vcsum = 0;
  774. if (g.ratio_data && g.ratio_data.length > 0) {
  775. for (let ratio of g.ratio_data) {
  776. let rIndex = gljUtil.getIndex(ratio);
  777. let rglj = gljKeyMap[rIndex];
  778. let ts = scMathUtil.roundForObj(parseFloat(ratio.consumption) * rglj.priceInfo.tenderPrice, decimalObj.glj.unitPrice);
  779. if (FixedCostMap[ratio.name]) {
  780. FixedCostItems.push(new FixedCostItem(ratio));
  781. fcsum = scMathUtil.roundForObj(fcsum + ts, decimalObj.glj.unitPrice);
  782. } else {
  783. VariableCostItems.push(new VariableCostItem(ratio));
  784. vcsum = scMathUtil.roundForObj(vcsum + ts, decimalObj.glj.unitPrice);
  785. }
  786. }
  787. }
  788. if (FixedCostItems.length > 0) {
  789. let fc = new FixedCost(fcsum);
  790. fc.children = FixedCostItems;
  791. this.children.push(fc);
  792. }
  793. if (VariableCostItems.length > 0) {
  794. let vc = new VariableCost(vcsum);
  795. vc.children = VariableCostItems;
  796. this.children.push(vc);
  797. }
  798. function VariableCost(sum) {
  799. const attrs = [{
  800. name: "VariableCostSum",
  801. value: sum,
  802. }];
  803. Element.call(this, "VariableCost", attrs);
  804. }
  805. function VariableCostItem(item) {
  806. const attrs = [{
  807. name: "VariableCostNo",
  808. value: item.code,
  809. },{
  810. name: "Consumption",
  811. value: item.consumption,
  812. }]
  813. Element.call(this, "VariableCostItem", attrs);
  814. }
  815. function FixedCost(sum) {
  816. const attrs = [{
  817. name: "FixedCostSum",
  818. value: sum,
  819. }, {
  820. name: "FixedRate",
  821. value: 1,
  822. }];
  823. Element.call(this, "FixedCost", attrs);
  824. }
  825. function FixedCostItem(item) {
  826. const attrs = [{
  827. name: "FixedCostNo",
  828. value: ratioCodeMap[item.code],
  829. },{
  830. name: "Sum",
  831. value: item.consumption,
  832. }]
  833. Element.call(this, "FixedCostItem", attrs);
  834. }
  835. }
  836. let Mps = new emptyElement("Mps");
  837. Mps.attrs = [{
  838. name: "KeyId",
  839. value: uuid.v1()
  840. }];
  841. let Materials = new emptyElement("Materials");
  842. Materials.attrs = [{
  843. name: "KeyId",
  844. value: uuid.v1()
  845. }];
  846. let Mechs = new emptyElement("Mechs");
  847. Mechs.attrs = [{
  848. name: "KeyId",
  849. value: uuid.v1()
  850. }];
  851. let gljKeyMap = {};
  852. let temMechs = [];
  853. if (isBidSubmission || isControl) { //导出到招标文件中,不输出这一部分。
  854. for (let g of pgljData.gljList) {
  855. if (!g.quantity) {
  856. continue;
  857. }
  858. let type = g.type + "";
  859. gljKeyMap[gljUtil.getIndex(g)] = g;
  860. type = type.charAt(0);
  861. if (type == "1") {
  862. Mps.children.push(new Mp(g));
  863. } else if (type == "2" || type == 5) {
  864. Materials.children.push(new Material(g));
  865. } else if (type == "3") {
  866. temMechs.push(g);
  867. }
  868. }
  869. for (let t of temMechs) {
  870. Mechs.children.push(new Mech(t,gljKeyMap));
  871. }
  872. }
  873. this.children.push(Mps);
  874. this.children.push(Materials);
  875. this.children.push(Mechs);
  876. }
  877. function EprjInfo(tenderProject) {
  878. let bills = tenderProject.Bills.datas;
  879. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  880. let totalItem = null;
  881. let proItem = null; //暂列金额项
  882. let safeItem = null;
  883. let oneToSevenItem = null;
  884. for (let b of bills) {
  885. if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.TOTAL_COST) totalItem = b;
  886. if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.PROVISIONAL) proItem = b;
  887. if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.ONE_SEVEN_BILLS) oneToSevenItem = b;
  888. if(b.code == "102-3" && b.name=="安全生产费") safeItem = b;
  889. }
  890. const attrs = [{
  891. name: "Name",
  892. value: tenderProject.projectInfo.name,
  893. },
  894. {
  895. name: "Sums",
  896. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  897. },
  898. {
  899. name: "KeyId",
  900. value: uuid.v1()
  901. }
  902. ];
  903. //输出控制价、投标文件时,取调价后的标段总造价。
  904. //输出招标文件时,取0
  905. if (isBidInvitation) attrs[1].value = 0;
  906. Element.call(this, "EprjInfo", attrs);
  907. this.children.push(new SummaryOfCost(totalItem, proItem,safeItem,oneToSevenItem,feature));
  908. this.children.push(new MakeInfo(tenderProject));
  909. this.children.push(new Params(tenderProject));
  910. this.children.push(new getBillsItems(tenderProject));
  911. this.children.push(new getIndexs(tenderProject));
  912. let bidEvaluationMainMaterials = getBidEvaluationMainMaterial(tenderProject);
  913. if(bidEvaluationMainMaterials.length > 0) this.children.push(...bidEvaluationMainMaterials);
  914. }
  915. function _getNumValueByExportKind(orgSum) {
  916. let rst = orgSum;
  917. // const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
  918. // const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
  919. // const isControl = exportKind === CONTROL; // 是否是控制价
  920. //根据导出类型(上面3个),输出实际合计或price
  921. if (isBidInvitation) {
  922. rst = 0;
  923. }
  924. return rst;
  925. }
  926. function _getStrValueByExportKind(orgStr) {
  927. let rst = orgStr;
  928. if (isBidInvitation) {
  929. rst = '';
  930. }
  931. return rst;
  932. }
  933. function getBidEvaluationMainMaterial(tenderProject) {
  934. let bidMaterials = [];
  935. let i = 1;
  936. for (let b of tenderProject.bidMaterialData) {
  937. bidMaterials.push(new BidEvaluationMainMaterial(b, i));
  938. i++
  939. }
  940. return bidMaterials;
  941. function BidEvaluationMainMaterial(b, index) {
  942. const attrs = [{
  943. name: "Code",
  944. value: b.seq,
  945. },
  946. {
  947. name: "Number",
  948. value: b.code
  949. },
  950. {
  951. name: "Name",
  952. value: b.name
  953. },
  954. {
  955. name: "Specification",
  956. value: b.specs
  957. },
  958. {
  959. name: "Unit",
  960. value: b.unit
  961. },
  962. {
  963. name: "Price",
  964. value: b.marketPrice || '0',
  965. type: TYPE.DECIMAL
  966. },
  967. {
  968. name: "LimitedPrice",
  969. value: b.marketPrice || '0',
  970. type: TYPE.DECIMAL
  971. },
  972. {
  973. name: "Quantity",
  974. value: 0,//b.quantity
  975. type: TYPE.DECIMAL
  976. },
  977. {
  978. name: "Total",
  979. value: 0//b.totalPrice
  980. },
  981. {
  982. name: "Remark",
  983. value: b.remark
  984. }
  985. ];
  986. if (isBidSubmission || isControl) {
  987. attrs[7].value = b.quantity;
  988. attrs[8].value = b.totalPrice;
  989. }
  990. Element.call(this, "BidEvaluationMainMaterial", attrs);
  991. }
  992. }
  993. function getIndexs(tenderProject) {
  994. let Indexs = new emptyElement('Indexs');
  995. Indexs.attrs = [{
  996. name: "KeyId",
  997. value: uuid.v1()
  998. }];
  999. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  1000. for (let f of feature) {
  1001. if (f.code) Indexs.children.push(new IndexItem(f))
  1002. }
  1003. return Indexs;
  1004. function IndexItem(fea) {
  1005. const attrs = [{
  1006. name: "Code",
  1007. value: fea.code,
  1008. },
  1009. {
  1010. name: "Name",
  1011. value: fea.dispName,
  1012. },
  1013. {
  1014. name: "Unit",
  1015. value: fea.unit,
  1016. },
  1017. {
  1018. name: "Value",
  1019. value: fea.value,
  1020. },
  1021. {
  1022. name: "Remark",
  1023. value: fea.remark,
  1024. },
  1025. {
  1026. name: "KeyId",
  1027. value: uuid.v1()
  1028. }
  1029. ]
  1030. Element.call(this, "IndexItem", attrs);
  1031. }
  1032. }
  1033. function getBillsItems(tenderProject) {
  1034. let items = new emptyElement("Items");
  1035. items.attrs =[{
  1036. name: "KeyId",
  1037. value: uuid.v1()
  1038. }];
  1039. let rootNodes = tenderProject.mainTree.roots;
  1040. for (let r of rootNodes) {
  1041. setItem(r, -1, items.children);
  1042. }
  1043. return items;
  1044. function setItem(bNode, level, list) {
  1045. if (bNode.sourceType == ModuleNames.ration) return;
  1046. let item = new bill(bNode, level);
  1047. if (bNode.children && bNode.children.length > 0) {
  1048. level += 1;
  1049. for (let c of bNode.children) {
  1050. setItem(c, level, item.children);
  1051. }
  1052. }
  1053. list.push(item);
  1054. function getCalcType(node) {
  1055. /*
  1056. 判断是否父项:
  1057. 是父项,则取1;
  1058. 是叶子项,则判断其下有无套定额/量价/工料机:
  1059. 有则取1;
  1060. 无则判断有无基数计算:
  1061. 有则取2;
  1062. 无则取3 */
  1063. if (node.children && node.children.length > 0) {
  1064. return 1; //是父项,则取1, 有套定额/量价/工料机,也取1
  1065. } else {
  1066. return node.data.calcBase && node.data.calcBase != "" ? 2 : 3
  1067. }
  1068. }
  1069. function getItemType(node) {
  1070. let Bills = projectObj.project.Bills;
  1071. //是100~900章部分、或是计日工部分,叶子清单输出1,父项输出0;
  1072. if (Bills.isBelongOneToSeven(node)||Bills.isBelongDayWork(node)) {
  1073. if (node.children && node.children.length > 0) {
  1074. return node.children[0].sourceType == ModuleNames.ration ? 1 : 0
  1075. }
  1076. return 1 //叶子清单输出1
  1077. } else {
  1078. return 0;
  1079. /* //非100~900章部分,
  1080. // 是暂列金额,判断暂列金额的金额等于0,则输出为0;暂列金额的金额不等于0,则输出为1;
  1081. if (node.data.name && node.data.name.indexOf("暂列金额") != -1) {
  1082. let sum = node.data.feesIndex && node.data.feesIndex.common ? node.data.feesIndex.common.tenderTotalFee : "";
  1083. return gljUtil.isNotEmpty(sum) ? 1 : 0
  1084. } else { //非暂列金额,则判断清单的工程量是否等于0,等于0,则输出0;不等于0,则输出1
  1085. return gljUtil.isNotEmpty(node.data.quantity) ? 1 : 0
  1086. } */
  1087. }
  1088. }
  1089. function bill(bNode, level) {
  1090. let data = bNode.data;
  1091. let CostKind = 3;
  1092. if (data.name && data.name.indexOf("安全生产费") != -1) CostKind = 1;
  1093. if (data.name && data.name.indexOf("暂列金额") != -1) CostKind = 2;
  1094. //1 = 工程量×综合单价;2 = 计算基数×费率;3 = 工程量×单价。
  1095. let CalcType = getCalcType(bNode);
  1096. //取暂估价类型。读取造价书界面的专项暂定列。0=材料暂估价,1=工程设备暂估价,2=专业工程暂估价,没有选的输出为空。
  1097. let ProvisionalType = "";
  1098. if (data.specialProvisional == "材料") ProvisionalType = 0;
  1099. if (data.specialProvisional == "工程设备") ProvisionalType = 1;
  1100. if (data.specialProvisional == "专业工程") ProvisionalType = 2;
  1101. //MpRatio
  1102. let MpRatio = "";
  1103. let MaterialRatio = "";
  1104. let MechRatio = "";
  1105. if (data.quantityCoe) {
  1106. if (data.quantityCoe["labour"]) MpRatio = data.quantityCoe["labour"];
  1107. if (data.quantityCoe["material"]) MaterialRatio = data.quantityCoe["material"];
  1108. if (data.quantityCoe["machine"]) MechRatio = data.quantityCoe["machine"];
  1109. }
  1110. let fail = billNameChecking(bNode,tenderProject.projectInfo.name,fixedFlag)
  1111. //fail: { hint: '错误提示', type: '提示所属(基本就是单位工程名称)' }
  1112. let ListCode = "";
  1113. if (ListCodeMap[data.name]) ListCode = ListCodeMap[data.name][0];
  1114. if (data.code && data.code != "") ListCode = data.code;
  1115. let formulaCode = "";
  1116. if (ListCodeMap[data.name]) formulaCode = ListCodeMap[data.name][1];
  1117. let perKeyId = '';
  1118. if (data.ParentID != -1) perKeyId = data.ParentID;
  1119. const attrs = [{
  1120. name: "ListCode",
  1121. value: ListCode,
  1122. },
  1123. {
  1124. name: "ListName",
  1125. value: data.name,
  1126. fail:fail
  1127. },
  1128. {
  1129. name: "Unit",
  1130. value: data.unit,
  1131. },
  1132. {
  1133. name: "Num",
  1134. value: data.quantity,
  1135. type: TYPE.DECIMAL,
  1136. toFix:3
  1137. },
  1138. {
  1139. name: "QtyFormula",
  1140. // value: data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",//data.calcBase //data.calcBase ? cbParser.toFExpr(data.calcBase, tenderProject.mainTree.items) : "",
  1141. value: _getStrValueByExportKind(data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : ""),
  1142. type: TYPE.DECIMAL,
  1143. toFix:2
  1144. },
  1145. {
  1146. name: "Price",
  1147. value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "",
  1148. type: TYPE.DECIMAL,
  1149. toFix:2
  1150. },
  1151. {
  1152. name: "Rate",
  1153. value: 100,
  1154. },
  1155. {
  1156. name: "Sum",
  1157. value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",
  1158. type: TYPE.DECIMAL,
  1159. toFix:2
  1160. },
  1161. {
  1162. name: "ChapterKind",
  1163. value: level > 3 ? 3 : level,
  1164. },
  1165. {
  1166. name: "CostKind",
  1167. value: CostKind,
  1168. },
  1169. {
  1170. name: "CalcType",
  1171. value: CalcType,
  1172. },
  1173. {
  1174. name: "ProvisionalType",
  1175. value: ProvisionalType,
  1176. mustHasValue:true
  1177. },
  1178. {
  1179. name: "MeterRules",
  1180. value: "",
  1181. },
  1182. {
  1183. name: "Content",
  1184. value: data.jobContentText,
  1185. },
  1186. {
  1187. name: "Remarks",
  1188. value: data.remark,
  1189. },
  1190. /* {
  1191. name: "MpRatio",
  1192. value: MpRatio,
  1193. },
  1194. {
  1195. name: "MaterialRatio",
  1196. value: MaterialRatio,
  1197. },
  1198. {
  1199. name: "MechRatio",
  1200. value: MechRatio,
  1201. },
  1202. {
  1203. name: "AdjustedPrice",
  1204. value: data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "",
  1205. },
  1206. {
  1207. name: "AdjustedSums",
  1208. value: data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",
  1209. }, */
  1210. {
  1211. name: "ItemType",
  1212. value: getItemType(bNode),
  1213. },
  1214. {
  1215. name: "FormulaCode",
  1216. value: formulaCode
  1217. },
  1218. {
  1219. name: "KeyId",
  1220. value: data.ID
  1221. },
  1222. {
  1223. name: "PerKeyId",
  1224. value: perKeyId
  1225. }
  1226. ];
  1227. //投标、招标控制价时。取单价。
  1228. //招标时,如果是“安全生产费”或“暂列金额”,取单价,否则取0。
  1229. if (isBidSubmission || isControl || CostKind==1 ||CostKind==2) {
  1230. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "";
  1231. attrs[7].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1232. //暂列金额 数量为0的时候,单价输出0
  1233. if( CostKind==2 && !gljUtil.isNotEmpty(data.quantity)) attrs[5].value = 0
  1234. }
  1235. Element.call(this, "Item", attrs);
  1236. let cc = CostComposition(bNode);
  1237. if (cc) this.children.push(cc);
  1238. this.children.push(CostStructure(data))
  1239. function CostComposition(bNode) {
  1240. if (isBidInvitation) return null;
  1241. let CostComposition = new emptyElement('CostComposition');
  1242. CostComposition.attrs =[{
  1243. name: "KeyId",
  1244. value: uuid.v1()
  1245. }];
  1246. let Norms = [];
  1247. let Costs = [];
  1248. if (bNode.children && bNode.children.length > 0 && bNode.children[0].sourceType == ModuleNames.ration) {
  1249. for (let r of bNode.children) {
  1250. if (r.data.type == rationType.ration) {
  1251. if(isEmptyRation(r.data)) continue;//定额空行不输出到接口文件中。
  1252. Norms.push(new Ration(r.data));
  1253. } else {
  1254. Costs.push(new Cost(r.data));
  1255. }
  1256. }
  1257. }
  1258. if (Norms.length > 0) CostComposition.children.push(...Norms);
  1259. if (Costs.length > 0) CostComposition.children.push(...Costs);
  1260. if (bNode.data.calcBase) CostComposition.children.push(new Formula(bNode.data));
  1261. return CostComposition.children.length > 0 ? CostComposition : null;
  1262. //定额空行不输出到接口文件中。 //定额空行的判断是:定额编码、定额名称、定额单位、定额单位、定额工程量为零或为空时
  1263. function isEmptyRation(ration){
  1264. return !gljUtil.isNotEmpty(ration.code)&&!gljUtil.isNotEmpty(ration.name)&&!gljUtil.isNotEmpty(ration.unit)&&(!gljUtil.isNotEmpty(ration.quantity)||ration.quantity == 0)
  1265. }
  1266. function Formula(bills) {
  1267. const attrs = [{
  1268. name: "Name",
  1269. value: bills.name
  1270. },
  1271. {
  1272. name: "Formulas",
  1273. value: bills.calcBase
  1274. },
  1275. {
  1276. name: "Ratio",
  1277. value: 1
  1278. },
  1279. {
  1280. name: "Sum",
  1281. value: bills.feesIndex && bills.feesIndex.common ? bills.feesIndex.common.tenderTotalFee : "",
  1282. type:TYPE.DECIMAL
  1283. },
  1284. {
  1285. name: "Remarks",
  1286. value: bills.remark
  1287. },
  1288. {
  1289. name: "KeyId",
  1290. value: uuid.v1()
  1291. }
  1292. ]
  1293. Element.call(this, "Formula", attrs);
  1294. // 1.Name
  1295. // 名称/描述。取清单的名称。
  1296. // 2.Formulas
  1297. // 计算式。读取计算基数的文本。
  1298. // 取基数计算窗口内容,基数直接转换为金额?参考标准文档的 7.11 及 7.12 节。
  1299. // 7.11是定额的费用,7.12是清单累进基数,主要是估概预算中用到,清单里的不同,所以中山的接口直接输出基数文本。
  1300. // 3.Ratio
  1301. // 系数。输出为1,非必填。
  1302. // 4.Sum
  1303. // 取金额。
  1304. // 5.Remarks
  1305. }
  1306. function Cost(item) {
  1307. let BasePrice = 0;
  1308. if (item.type == rationType.volumePrice) { // 当插入的是量价时,基价读取单价列。
  1309. BasePrice = item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
  1310. } else {
  1311. BasePrice = getBasePrice(item.projectGLJID, tenderProject)
  1312. }
  1313. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  1314. let CostTypeNo = '';
  1315. if (feeRateMap[calcMap[item.programID]]) CostTypeNo = feeRateMap[calcMap[item.programID]];
  1316. const attrs = [{
  1317. name: "Code",
  1318. value: item.code,
  1319. }, {
  1320. name: 'Name',
  1321. value: item.name
  1322. }, {
  1323. name: 'Spec',
  1324. value: item.specs
  1325. }, {
  1326. name: 'Unit',
  1327. value: item.unit
  1328. }, {
  1329. name: 'Num',
  1330. value: item.tenderQuantity
  1331. }, {
  1332. name: 'BasePrice',
  1333. value: BasePrice
  1334. }, {
  1335. name: 'Price',
  1336. value: item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
  1337. }, {
  1338. name: 'IsEquipment',
  1339. value: item.subType == gljType.EQUIPMENT ? 1 : 0
  1340. }, {
  1341. name: 'CostTypeNo',
  1342. value: CostTypeNo
  1343. }, {
  1344. name: 'ProfitRate',
  1345. value: getFeeRate(item.programID, 'profit', tenderProject)
  1346. },
  1347. {
  1348. name: 'TaxRate',
  1349. value: getFeeRate(item.programID, 'tax', tenderProject)
  1350. },
  1351. {
  1352. name: 'MpRatio',
  1353. value: item.subType == gljType.LABOUR ? 100 : 0
  1354. },
  1355. {
  1356. name: 'MaterialRatio',
  1357. value: item.subType == gljType.GENERAL_MATERIAL ? 100 : 0
  1358. },
  1359. {
  1360. name: 'MechRatio',
  1361. value: item.subType == gljType.GENERAL_MACHINE ? 100 : 0
  1362. }
  1363. ]
  1364. Element.call(this, "Cost", attrs);
  1365. this.children.push(CostStructure(item));
  1366. }
  1367. function Ration(ration) {
  1368. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  1369. let CostTypeNo = '';
  1370. if (feeRateMap[calcMap[ration.programID]]) CostTypeNo = feeRateMap[calcMap[ration.programID]];
  1371. const attrs = [{
  1372. name: "NormLibNo",
  1373. value: 'YSDE-000000-2018-86',
  1374. }, {
  1375. name: 'DisplayCode',
  1376. value: ration.code
  1377. }, {
  1378. name: 'Name',
  1379. value: ration.name
  1380. }, {
  1381. name: 'Unit',
  1382. value: ration.unit
  1383. }, {
  1384. name: 'Num',
  1385. value: ration.tenderQuantity
  1386. },
  1387. {
  1388. name: 'CostTypeNo',
  1389. value: CostTypeNo
  1390. },
  1391. {
  1392. name: 'ProfitRate',
  1393. value: getFeeRate(ration.programID, 'profit', tenderProject) //tenderProject.ProfitRate
  1394. },
  1395. {
  1396. name: 'TaxRate',
  1397. value: getFeeRate(ration.programID, 'tax', tenderProject) //tenderProject.TaxRate
  1398. },
  1399. {
  1400. name: 'FabricationCost',
  1401. value: ration.feesIndex && ration.feesIndex.common ? ration.feesIndex.common.tenderTotalFee : 0
  1402. },
  1403. {
  1404. name: 'AdjustStatus',
  1405. value: ration.adjustState
  1406. }
  1407. ]
  1408. Element.call(this, "Norm", attrs);
  1409. this.children.push(CostStructure(ration));
  1410. this.children.push(Consume(ration));
  1411. }
  1412. }
  1413. function Consume(ration) {
  1414. let consume = new emptyElement('Consume');
  1415. for (let rg of ration.rationGLJList) {
  1416. consume.children.push(new ConsumeItem(rg));
  1417. }
  1418. return consume;
  1419. function ConsumeItem(rg) {
  1420. const attrs = [{
  1421. name: "Code",
  1422. value: rg.code,
  1423. }, {
  1424. name: "Consumption",
  1425. value: rg.tenderQuantity
  1426. }];
  1427. Element.call(this, "ConsumeItem", attrs);
  1428. }
  1429. }
  1430. function CostStructure(item) {
  1431. let CostStructure = new emptyElement('CostStructure');
  1432. CostStructure.attrs = [{
  1433. name: "KeyId",
  1434. value: uuid.v1()
  1435. }];
  1436. for (let f of cpFeeTypes) {
  1437. if(itemFeeMap[f.type]) CostStructure.children.push(new CostItem(item,f.type))
  1438. }
  1439. if (CostStructure.children.length == 0) CostStructure.children.push(new CostItem({},""))
  1440. function CostItem(item,type) {
  1441. const attrs = [{
  1442. name: "ItemNo",
  1443. value: itemFeeMap[type],
  1444. }, {
  1445. name: 'Sum',
  1446. value: 0 //fee.tenderTotalFee
  1447. }, {
  1448. name: "KeyId",
  1449. value: uuid.v1()
  1450. }
  1451. ]
  1452. if ((isBidSubmission || isControl) && item.feesIndex && item.feesIndex[type]) attrs[1].value = item.feesIndex[type].tenderTotalFee;
  1453. Element.call(this, "CostItem", attrs);
  1454. }
  1455. return CostStructure;
  1456. }
  1457. }
  1458. }
  1459. }
  1460. function Params(tenderProject) {
  1461. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  1462. let featrueMap = {};
  1463. let baseMap = {};
  1464. for (let f of feature) {
  1465. featrueMap[f.key] = f;
  1466. }
  1467. let baseInfo = _.find(tenderProject.property.basicInformation, {
  1468. dispName: "基本信息",
  1469. });
  1470. for (let i of baseInfo.items) {
  1471. let key = i.key;
  1472. //if (i.dispName == "编制日期") key = "编制时间";
  1473. baseMap[key] = i;
  1474. }
  1475. let BuildType = "";
  1476. if (baseMap["natureConstruction"].value == "新建") BuildType = 0;
  1477. if (baseMap["natureConstruction"].value == "改扩建") BuildType = 1;
  1478. let Terrain = "";
  1479. if (baseMap["terrainCategory"].value == "平原微丘") Terrain = 0;
  1480. if (baseMap["terrainCategory"].value == "山岭重丘") Terrain = 1;
  1481. let DesignSpeed = featrueMap["designSpeed"].value;
  1482. let Structure = "";
  1483. if (featrueMap["pavementStructure"].value == "沥青路面") Structure = 0;
  1484. if (featrueMap["pavementStructure"].value == "水泥混凝土路面") Structure = 1;
  1485. if (featrueMap["pavementStructure"].value == "其他类型路面") Structure = 2;
  1486. let RoadGrade = "";
  1487. if (RoadGradeMap[baseMap["roadGrade"].value]) RoadGrade = RoadGradeMap[baseMap["roadGrade"].value];
  1488. const attrs = [{
  1489. name: "PrjArea",
  1490. value: baseMap["location"] ? baseMap["location"].value : ""
  1491. },
  1492. {
  1493. name: "StartPileNo",
  1494. value: baseMap["startChainages"] ? baseMap["startChainages"].value : "",
  1495. mustHasValue: true
  1496. },
  1497. {
  1498. name: "EndPileNo",
  1499. value: baseMap["endChainages"] ? baseMap["endChainages"].value : "",
  1500. mustHasValue: true
  1501. },
  1502. {
  1503. name: "BuildType",
  1504. value: BuildType,
  1505. },
  1506. {
  1507. name: "Terrain",
  1508. value: Terrain,
  1509. mustHasValue: true
  1510. },
  1511. {
  1512. name: "RoadGrade",
  1513. value: RoadGrade,
  1514. mustHasValue: true
  1515. },
  1516. {
  1517. name: "DesignSpeed",
  1518. value: DesignSpeed,
  1519. mustHasValue: true
  1520. },
  1521. {
  1522. name: "Structure",
  1523. value: Structure,
  1524. mustHasValue: true
  1525. },
  1526. {
  1527. name: "SubgradeWidth",
  1528. value: featrueMap["subgradeWidth"] ? featrueMap["subgradeWidth"].value : "",
  1529. mustHasValue: true
  1530. },
  1531. {
  1532. name: "RoadLength",
  1533. value: featrueMap["roadLength"] ? featrueMap["roadLength"].value : "",
  1534. mustHasValue: true
  1535. },
  1536. {
  1537. name: "BridgeLength",
  1538. value: featrueMap["bridgeLength"] ? featrueMap["bridgeLength"].value : "",
  1539. mustHasValue: true
  1540. },
  1541. {
  1542. name: "TunnelLength",
  1543. value: featrueMap["tunnelLength"] ? featrueMap["tunnelLength"].value : "",
  1544. mustHasValue: true
  1545. },
  1546. {
  1547. name: "BriTunRate",
  1548. value: featrueMap["briTunRate"] ? featrueMap["briTunRate"].value : "",
  1549. mustHasValue: true
  1550. },
  1551. {
  1552. name: "InterchangeNum",
  1553. value: featrueMap["interchangeNum"] ? featrueMap["interchangeNum"].value : "",
  1554. mustHasValue: true
  1555. },
  1556. {
  1557. name: "StubLengths",
  1558. value: featrueMap["stubLengths"] ? featrueMap["stubLengths"].value : "",
  1559. mustHasValue: true
  1560. },
  1561. {
  1562. name: "LaneLength",
  1563. value: featrueMap["laneLength"] ? featrueMap["laneLength"].value : "",
  1564. mustHasValue: true
  1565. },
  1566. {
  1567. name: "KeyId",
  1568. value: uuid.v1()
  1569. }
  1570. ];
  1571. Element.call(this, "Params", attrs);
  1572. }
  1573. function SummaryOfCost(totalItem, proItem,safeItem,oneToSevenItem,feature) {
  1574. let attrs = [{
  1575. name: "TenderSumLimit",
  1576. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1577. type: TYPE.DECIMAL,
  1578. toFix:2,
  1579. },
  1580. {
  1581. name: "BidTotal",
  1582. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1583. type: TYPE.DECIMAL,
  1584. toFix:2,
  1585. },
  1586. {
  1587. name: "BillTotal",
  1588. value: oneToSevenItem.feesIndex && oneToSevenItem.feesIndex.common && oneToSevenItem.feesIndex.common.tenderTotalFee ? oneToSevenItem.feesIndex.common.tenderTotalFee : 0,
  1589. type: TYPE.DECIMAL,
  1590. toFix:2,
  1591. },
  1592. {
  1593. name: "CostForHSE",
  1594. value: safeItem && safeItem.feesIndex && safeItem.feesIndex.common && safeItem.feesIndex.common.tenderTotalFee ? safeItem.feesIndex.common.tenderTotalFee : 0,
  1595. type: TYPE.DECIMAL,
  1596. toFix:2,
  1597. },
  1598. {
  1599. name: "ProvisionalSums",
  1600. value: proItem.feesIndex && proItem.feesIndex.common && proItem.feesIndex.common.tenderTotalFee ? proItem.feesIndex.common.tenderTotalFee : 0,
  1601. type: TYPE.DECIMAL,
  1602. toFix:2,
  1603. },
  1604. {
  1605. name: "Appraisal",
  1606. value: totalItem.feesIndex && totalItem.feesIndex.estimate && totalItem.feesIndex.estimate.tenderTotalFee ? totalItem.feesIndex.estimate.tenderTotalFee : 0,
  1607. type: TYPE.DECIMAL,
  1608. toFix:2,
  1609. },
  1610. ];
  1611. if (isBidInvitation) {
  1612. attrs.splice(0, 3) //招标
  1613. }
  1614. //if (isControl) attrs.splice(1, 5); //控制价
  1615. if (isBidSubmission) { //投标文件时,读工程特征中的 招标控制价 值
  1616. let tenderSumLimit = _.find(feature, { "key": "tenderSumLimit" });
  1617. if(tenderSumLimit) attrs[0].value = tenderSumLimit.value
  1618. }
  1619. Element.call(this, "SummaryOfCost", attrs);
  1620. }
  1621. function MakeInfo(tenderProject) {
  1622. let property = tenderProject.property;
  1623. let baseMap = {};
  1624. let baseInfo = _.find(property.basicInformation, {
  1625. dispName: "基本信息",
  1626. });
  1627. for (let i of baseInfo.items) {
  1628. let key = i.key;
  1629. //if (i.dispName == "编制日期") key = "编制时间";
  1630. baseMap[key] = i;
  1631. }
  1632. //mustHasValue
  1633. const attrs = [{
  1634. name: "ValuationModel",
  1635. value: property.taxType,
  1636. },
  1637. {
  1638. name: "Manage",
  1639. value: baseMap["constructingUnit"] ? baseMap["constructingUnit"].value : "",
  1640. },
  1641. {
  1642. name: "Designer",
  1643. value: baseMap["designUnit"] ? baseMap["designUnit"].value : "",
  1644. mustHasValue:true
  1645. },
  1646. {
  1647. name: "Compile",
  1648. value: baseMap["compileUnit"] ? baseMap["compileUnit"].value : "",
  1649. },
  1650. {
  1651. name: "CompileApprover",
  1652. value: baseMap["compileApprover"] ? baseMap["compileApprover"].value : "",
  1653. },
  1654. {
  1655. name: "CompileCertNo",
  1656. value: baseMap["compileCertNo"] ? baseMap["compileCertNo"].value : "",
  1657. mustHasValue:true
  1658. },
  1659. {
  1660. name: "CompileDate",
  1661. value: baseMap["compileDate"] && baseMap["compileDate"].value != "" ? baseMap["compileDate"].value + "T00:00:00" : "",
  1662. mustHasValue:true
  1663. },
  1664. {
  1665. name: "Review",
  1666. value: baseMap["reviewUnit"] ? baseMap["reviewUnit"].value : "",
  1667. mustHasValue:true
  1668. },
  1669. {
  1670. name: "ReviewApprover",
  1671. value: baseMap["reviewApprover"] ? baseMap["reviewApprover"].value : "",
  1672. mustHasValue:true
  1673. },
  1674. {
  1675. name: "ReviewCertNo",
  1676. value: baseMap["reviewCertNo"] ? baseMap["reviewCertNo"].value : "",
  1677. mustHasValue:true
  1678. },
  1679. {
  1680. name: "ReviewDate",
  1681. value: baseMap["reviewDate"] && baseMap["reviewDate"].value != "" ? baseMap["reviewDate"].value + "T00:00:00" : "",
  1682. mustHasValue:true
  1683. },
  1684. {
  1685. name: "Examine",
  1686. value: baseMap["examineUnit"] ? baseMap["examineUnit"].value : "",
  1687. mustHasValue:true
  1688. },
  1689. {
  1690. name: "ExamineApprover",
  1691. value: baseMap["examineApprover"] ? baseMap["examineApprover"].value : "",
  1692. mustHasValue:true
  1693. },
  1694. {
  1695. name: "ExamineCertNo",
  1696. value: baseMap["examineCertNo"] ? baseMap["examineCertNo"].value : "",
  1697. mustHasValue:true
  1698. },
  1699. {
  1700. name: "ExamineDate",
  1701. value: baseMap["examineDate"] && baseMap["examineDate"].value != "" ? baseMap["examineDate"].value + "T00:00:00" : "",
  1702. mustHasValue:true
  1703. },
  1704. {
  1705. name: "CompileExplain",
  1706. value: baseMap["compileExplain"] ? baseMap["compileExplain"].value : "",
  1707. mustHasValue:true
  1708. },
  1709. {
  1710. name: "ExamineExplain",
  1711. value: baseMap["examineExplain"] ? baseMap["examineExplain"].value : "",
  1712. mustHasValue:true
  1713. },
  1714. {
  1715. name: "ProjectExplain",
  1716. value: baseMap["projectExplain"] ? baseMap["projectExplain"].value : "",
  1717. mustHasValue:true
  1718. },
  1719. {
  1720. name: "KeyId",
  1721. value: uuid.v1()
  1722. }
  1723. ];
  1724. if (isBidInvitation) { //招标文件,则以下的8、12~18则不输出
  1725. attrs.splice(11, 7);
  1726. attrs.splice(7, 1);
  1727. }
  1728. Element.call(this, "MakeInfo", attrs);
  1729. }
  1730. let data = new CprjInfo(projectData.name);
  1731. data.children.push(new SystemInfo(projectData));
  1732. data.children.push(new CostBasis());
  1733. let seriNo = 1;
  1734. let Rates = [];
  1735. let Practs = [];
  1736. let EprjInfos = [];
  1737. for (let c of projectData.children) {
  1738. let tenderProject = tenderDetailMap[c.ID];
  1739. let feeRataDatas = tenderProject.FeeRate.datas;
  1740. Rates.push(new Rate(tenderProject, feeRataDatas, seriNo));
  1741. Practs.push(new Pract(tenderProject, seriNo));
  1742. EprjInfos.push(new EprjInfo(tenderProject));
  1743. seriNo++;
  1744. }
  1745. data.children.push(...Rates,...Practs,...EprjInfos);
  1746. return [{
  1747. data: data,
  1748. exportKind: exportKind,
  1749. fileName: projectData.name + INTERFACE_CONFIG[areaKey]["fileSuffix"][exportKind],
  1750. }, ];
  1751. }
  1752. return {
  1753. entry,
  1754. };
  1755. })();