guangdong_zhongshan.js 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712
  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章至900章清单":"1",
  115. "清单 第100章 总则": "一",
  116. "清单 第200章 路基": "二",
  117. "清单 第300章 路面": "三",
  118. "清单 第400章 桥梁、涵洞工程": "四",
  119. "清单 第500章 隧道": "五",
  120. "清单 第600章 交通安全设施": "六",
  121. "清单 第700章 绿化及环境保护设施": "七",
  122. "清单 第800章 机电工程": "八",
  123. "清单 第900章 附属区房建工程": "九",
  124. "已包含在清单合计中的材料、工程设备、专业工程暂估价合计": "10",
  125. "清单合计减去材料、工程设备、专业工程暂估价合计": "11",
  126. "计日工合计": "12",
  127. "劳务": "12.1",
  128. "材料": "12.2",
  129. "机械": "12.3",
  130. "暂列金额(不含计日工总额)": "13",
  131. "投标报价": "14"
  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章至900章清单" || data.name == "第100章至900章清单合计";
  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. /* case fixedFlag.LABOUR_SERVICE:
  176. pass = data.name == "劳务";
  177. break;
  178. case fixedFlag.MATERIAL:
  179. pass = data.name == "材料";
  180. break;
  181. case fixedFlag.CONSTRUCTION_MACHINE:
  182. pass = data.name == "机械";
  183. break; */
  184. case fixedFlag.PROVISIONAL:
  185. pass = data.name == "暂列金额(不含计日工总额)";
  186. break;
  187. case fixedFlag.TOTAL_COST:
  188. pass = data.name == "投标报价";
  189. break;
  190. case fixedFlag.ONE_HUNDRED_BILLS:
  191. pass = data.name == "清单 第100章 总则";
  192. break;
  193. }
  194. } else {
  195. if (bNode.parent) {
  196. const pdata = bNode.parent.data;
  197. if (pdata.flagsIndex && pdata.flagsIndex.fixed && pdata.flagsIndex.fixed.flag == fixedFlag.ONE_SEVEN_BILLS) {
  198. if (!sectionNameMap[data.name]) pass = false
  199. }
  200. }
  201. }
  202. if(pass == false)fail = { hint: `清单:"${data.name?data.name:""}",名字不符合规范!`, type: projectName }
  203. return fail;
  204. }
  205. /**
  206. *
  207. * @param {String} areaKey - 地区标识,如:'安徽@马鞍山',有些地区的接口只是取值上有不同,共有一个接口脚本, 需要通过地区标识确定一些特殊处理
  208. * @param {Number} exportKind - 导出类型,招标、投标、控制价
  209. * @param {Object} projectData - 项目表数据:{ 建设项目Data, children: [单位工程...] }
  210. * @param {Object} tenderDetailMap - 单位工程ID与getData接口数据(projectObj.project的结构)的映射。
  211. * @return {Promise<Array>} - 返回的数据结构必须按照规定:[{ data, exportKind, fileName }],参考web\building_saas\standard_interface\index.js中的注释说明
  212. */
  213. async function entry(areaKey, exportKind, projectData, tenderDetailMap) {
  214. const {
  215. CONFIG: {
  216. TYPE
  217. },
  218. UTIL,
  219. Element
  220. } = INTERFACE_EXPORT_BASE;
  221. const {
  222. EXPORT_KIND: {
  223. BID_INVITATION,
  224. BID_SUBMISSION,
  225. CONTROL
  226. },
  227. fixedFlag,
  228. } = window.commonConstants;
  229. let cprjType = {
  230. 1: "GCLQD", // 招标
  231. 2: "TBBJ", // 投标
  232. 3: "ZBKZJ", // 控制价
  233. };
  234. const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
  235. const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
  236. const isControl = exportKind === CONTROL; // 是否是控制价
  237. function emptyElement(name) {
  238. this.name = name;
  239. this.attrs = [];
  240. this.children = [];
  241. }
  242. // 建设项目根节点信息
  243. function CprjInfo(projectName) {
  244. const attrs = [{
  245. name: "CprjName",
  246. value: projectName,
  247. },
  248. {
  249. name: "CprjType",
  250. value: cprjType[exportKind],
  251. },
  252. ];
  253. Element.call(this, "CprjInfo", attrs);
  254. }
  255. // 项目基本信息
  256. function SystemInfo(projectData) {
  257. let baseInfo = _.find(projectData.property.basicInformation, {
  258. dispName: "基本信息",
  259. });
  260. //“招标工程量清单”、“招标控制价”时,输出该字段,为导出该文件的当前时间
  261. let makeData = {
  262. value : UTIL.getNowFormatTime(true)
  263. }
  264. //投标的时候取基本信息的makeData字段
  265. if(isBidSubmission) makeData = _.find(baseInfo.items, { "key": "makeDate" });
  266. let hardID = UTIL.generateHardwareId();
  267. let [cpuId, diskId, macId] = hardID.split(";");
  268. const attrs = [{
  269. name: "Name",
  270. value: "公路工程造价数据标准",
  271. },
  272. {
  273. name: "Version",
  274. value: "1.0",
  275. },
  276. {
  277. name: "SoftwareName",
  278. value: "纵横公路云造价",
  279. },
  280. {
  281. name: "SoftwareVer",
  282. value: "V" + VERSION,
  283. },
  284. {
  285. name: "SoftwareCompany",
  286. value: "珠海纵横创新软件有限公司",
  287. },
  288. {
  289. name: "MakeDate",
  290. value: makeData?makeData.value:"",
  291. },
  292. {
  293. name: "Key1",
  294. value: window.btoa(userID),
  295. },
  296. {
  297. name: "Key2",
  298. value: window.btoa(diskId),
  299. },
  300. {
  301. name: "Key3",
  302. value: window.btoa(macId),
  303. },
  304. ];
  305. if (isBidSubmission)
  306. attrs.splice(6, 0, {
  307. name: "BidderVer",
  308. value: UTIL.getNowFormatTime(true),
  309. });
  310. Element.call(this, "SystemInfo", attrs);
  311. }
  312. //造价依据
  313. function CostBasis() {
  314. // ItemStandardNo="GYSFX-000000-2018-86"
  315. const attrs = [{
  316. name: "MakeRuleNo",
  317. value: "GYSBB-000000-2018-86",
  318. },
  319. {
  320. name: "MakeRuleName",
  321. value: "公路工程建设项目概算预算编制办法",
  322. },
  323. {
  324. name: "ItemStandardNo",
  325. value: "GYSFX-000000-2018-86",
  326. },
  327. ];
  328. Element.call(this, "CostBasis", attrs);
  329. //定额库信息
  330. //to do 改成实际的值
  331. function NormLib() {
  332. const attrs = [{
  333. name: "NormLibNo",
  334. value: "YSDE-000000-2018-86",
  335. },
  336. {
  337. name: "NormLibName",
  338. value: "部颁公路工程预算定额(2018)",
  339. },
  340. {
  341. name: "Type",
  342. value: "ZDEK",
  343. },
  344. ];
  345. Element.call(this, "NormLib", attrs);
  346. }
  347. this.children.push(new NormLib());
  348. }
  349. function Rate(tenderProject, feeRateInfo, seirNo) {
  350. //RateNo="1" Name="纵横软件测试版本" RateLibNo="GYSFL-000000-2018-86"
  351. const attrs = [{
  352. name: "RateNo",
  353. value: seirNo,
  354. },
  355. {
  356. name: "Name",
  357. value: feeRateInfo.name,
  358. },
  359. {
  360. name: "RateLibNo",
  361. value: feeLibNoMap[feeRateInfo.libID],
  362. },
  363. ];
  364. Element.call(this, "Rate", attrs);
  365. let RateParams = new emptyElement("RateParams");
  366. let subRates = projectObj.project.FeeRate.getAllSubRates(feeRateInfo.rates);
  367. for (let s of subRates) {
  368. let sname = s.name.replace("(%)", "");
  369. sname = sname.replace("(%)", "");
  370. if (feeRateMap[sname]) {
  371. let value = "";
  372. if (s.editable) {
  373. let sel = _.find(s.optionList, {
  374. selected: true,
  375. });
  376. if (sel) {
  377. value = sel.name;
  378. } else if (gljUtil.isDef(s.value)) {
  379. value = s.value;
  380. }
  381. } else {
  382. value = _.findIndex(s.optionList, {
  383. selected: true,
  384. });
  385. if (value == -1) value = 0;
  386. }
  387. /* if (sname == '利润') tenderProject.ProfitRate = value;
  388. if (sname == '税金') tenderProject.TaxRate = value; */
  389. RateParams.children.push(new RateParam(feeRateMap[sname], value));
  390. }
  391. }
  392. this.children.push(RateParams);
  393. function RateParam(RateTypeNo, RateParamNo) {
  394. //<RateParam RateTypeNo="DJSGZJFFL" RateParamNo="0" Ratio="100"/>
  395. const attrs = [{
  396. name: "RateTypeNo",
  397. value: RateTypeNo,
  398. },
  399. {
  400. name: "RateParamNo",
  401. value: RateParamNo,
  402. },
  403. {
  404. name: "Ratio",
  405. value: "100",
  406. },
  407. ];
  408. Element.call(this, "RateParam", attrs);
  409. }
  410. let RateValues = new emptyElement("RateValues");
  411. function RateValue(CostTypeNo, RateTypeNo, value) {
  412. const attrs = [{
  413. name: "CostTypeNo",
  414. value: CostTypeNo,
  415. },
  416. {
  417. name: "RateTypeNo",
  418. value: RateTypeNo,
  419. },
  420. {
  421. name: "RateValue",
  422. value: value,
  423. },
  424. ];
  425. Element.call(this, "RateValue", attrs);
  426. }
  427. let prefix = "";
  428. for (let r of feeRateInfo.rates) {
  429. if (!r.ParentID && feeRateMap[r.name]) prefix = feeRateMap[r.name];
  430. if (feeRateMap[r.name] && r.ParentID) {
  431. RateValues.children.push(new RateValue(prefix, feeRateMap[r.name], r.rate));
  432. }
  433. }
  434. this.children.push(RateValues);
  435. }
  436. function Pract(tpdata, seriNo) {
  437. let pgljData = tpdata.projectGLJ.datas;
  438. let decimalObj = tpdata.property.decimal;
  439. const attrs = [{
  440. name: "PractNo",
  441. value: seriNo,
  442. },
  443. {
  444. name: "Name",
  445. value: pgljData.constData.usedUnitPriceInfo.name,
  446. },
  447. ];
  448. Element.call(this, "Pract", attrs);
  449. let Param = {
  450. name: "Param",
  451. attrs: [{
  452. name: "TaxLibNo",
  453. value: "CCSBZ-440000-2019-544",
  454. },
  455. {
  456. name: "AuxRate",
  457. value: pgljData.constData.assistProductionFeeRate,
  458. },
  459. ],
  460. children: [],
  461. };
  462. if (isBidSubmission || isControl) { //导出到招标文件中,不输出这一部分。
  463. let elecDatas = electrovalenceObj.getElectrovalenceDatas(null, pgljData.com_electrovalence, pgljData.gljList);
  464. electrovalenceObj.calcPertElectrovalenceMarketPrice(elecDatas);
  465. for (let e of elecDatas) {
  466. let Electro = {
  467. name: "Electro",
  468. attrs: [{
  469. name: "Code",
  470. value: e.code,
  471. },
  472. {
  473. name: "Price",
  474. value: e.electPrice,
  475. },
  476. {
  477. name: "Ratio",
  478. value: e.coe,
  479. },
  480. ],
  481. children: [],
  482. };
  483. Param.children.push(Electro);
  484. }
  485. }
  486. this.children.push(Param);
  487. function Mp(g) {
  488. const attrs = [{
  489. name: "Code",
  490. value: g.code,
  491. },
  492. {
  493. name: "PractName",
  494. value: g.name,
  495. },
  496. {
  497. name: "Spec",
  498. value: g.specs,
  499. },
  500. {
  501. name: "Unit",
  502. value: g.unit,
  503. },
  504. {
  505. name: "BudgetPrice",
  506. value: g.priceInfo.tenderPrice,
  507. },
  508. {
  509. name: "NormPrice",
  510. value: g.priceInfo.basePrice,
  511. },
  512. {
  513. name: "IsAdd",
  514. value: g.unit_price.is_add,
  515. },
  516. ];
  517. Element.call(this, "Mp", attrs);
  518. }
  519. function Material(g) {
  520. const attrs = [{
  521. name: "Code",
  522. value: g.code,
  523. },
  524. {
  525. name: "PractName",
  526. value: g.name,
  527. },
  528. {
  529. name: "Spec",
  530. value: g.specs,
  531. },
  532. {
  533. name: "Unit",
  534. value: g.unit,
  535. },
  536. {
  537. name: "BudgetPrice",
  538. value: g.priceInfo.tenderPrice,
  539. },
  540. {
  541. name: "NormPrice",
  542. value: g.priceInfo.basePrice,
  543. },
  544. {
  545. name: "IsAdd",
  546. value: g.unit_price.is_add,
  547. },
  548. {
  549. name: "OrgPrice",
  550. value: g.unit_price.originalPrice ? g.unit_price.originalPrice : 0,
  551. },
  552. {
  553. name: "TransFee",
  554. value: g.unit_price.unitFreight ? g.unit_price.unitFreight : 0,
  555. },
  556. {
  557. name: "GwRate",
  558. value: g.unit_price.grossWeightCoe_n ? g.unit_price.grossWeightCoe_n : 0,
  559. },
  560. {
  561. name: "OffSiteLf",
  562. value: g.unit_price.offSiteTransportLossRate_n ? g.unit_price.offSiteTransportLossRate_n : 0,
  563. },
  564. {
  565. name: "OnSiteLf",
  566. value: 0,
  567. },
  568. {
  569. name: "LoadLf",
  570. value: g.unit_price.handlingLossRate_n ? g.unit_price.handlingLossRate_n : 0,
  571. },
  572. {
  573. name: "StoreRate",
  574. value: g.unit_price.purchaseStorageRate_n ? g.unit_price.purchaseStorageRate_n : 0,
  575. },
  576. {
  577. name: "PackageRecycleFee",
  578. value: g.unit_price.packageRecoverValue ? g.unit_price.packageRecoverValue : 0,
  579. },
  580. ];
  581. Element.call(this, "Material", attrs);
  582. // if (g.unit_price.calcMaterial == 1) { //有材料计算
  583. // let index = gljUtil.getIndex(g);
  584. // let orList = [];
  585. // for (let o of pgljData.originalList) {
  586. // if (o.connect_key == index) orList.push(new OrgPrices(o));
  587. // }
  588. // if (orList.length > 0) this.children = orList;
  589. // }
  590. function CostStructure(r) {
  591. //待获取
  592. this.name = "CostStructure";
  593. this.attrs = [];
  594. this.children = [];
  595. }
  596. function Consume(r, o) {
  597. this.name = "Consume";
  598. this.attrs = [];
  599. this.children = [];
  600. for (let g of o.ration_gljs) {
  601. if (g.rationID == r.ID) {
  602. let r_quantity = scMathUtil.roundForObj(r.quantity, tpdata.property.decimal.ration.quantity);
  603. this.children.push(new ConsumeItem(g, r_quantity));
  604. }
  605. }
  606. }
  607. function ConsumeItem(g, ration_quantity) {
  608. const attrs = [{
  609. name: "Code", //待获取
  610. value: g.code,
  611. },
  612. {
  613. name: "Consumption",
  614. value: scMathUtil.roundForObj(ration_quantity * parseFloat(g.quantity), tpdata.property.decimal.glj.quantity),
  615. },
  616. ];
  617. Element.call(this, "ConsumeItem", attrs);
  618. }
  619. function Norm(r, o) {
  620. const attrs = [{
  621. name: "NormLibNo", //待获取
  622. value: "",
  623. },
  624. {
  625. name: "DisplayCode",
  626. value: r.code,
  627. },
  628. {
  629. name: "Name",
  630. value: r.name,
  631. },
  632. {
  633. name: "Unit",
  634. value: r.unit,
  635. },
  636. {
  637. name: "Num",
  638. value: r.quantity,
  639. },
  640. {
  641. name: "CostTypeNo",
  642. value: "", //待获取
  643. },
  644. {
  645. name: "FabricationCost", //待获取
  646. value: "",
  647. },
  648. {
  649. name: "AdjustStatus",
  650. value: "",
  651. },
  652. ];
  653. Element.call(this, "Norm", attrs);
  654. this.children.push(new CostStructure(r));
  655. this.children.push(new Consume(r, o));
  656. }
  657. function SelfCollect(o) {
  658. const attrs = [{
  659. name: "OtherCost",
  660. value: 0,
  661. }, ];
  662. Element.call(this, "SelfCollect", attrs);
  663. for (let r of o.rations) {
  664. this.children.push(new Norm(r, o));
  665. }
  666. }
  667. function OrgPrices(o) {
  668. const attrs = [{
  669. name: "OrgPricevalue",
  670. value: o.supplyPrice,
  671. },
  672. {
  673. name: "Ratio",
  674. value: o.coe,
  675. },
  676. ];
  677. Element.call(this, "OrgPrices", attrs);
  678. if (!o.rations) return;
  679. this.children.push(new SelfCollect(o));
  680. }
  681. }
  682. function Mech(g,gljKeyMap) {
  683. const attrs = [{
  684. name: "Code",
  685. value: g.code,
  686. },
  687. {
  688. name: "PractName",
  689. value: g.name,
  690. },
  691. {
  692. name: "Spec",
  693. value: g.specs,
  694. },
  695. {
  696. name: "Unit",
  697. value: g.unit,
  698. },
  699. {
  700. name: "BudgetPrice",
  701. value: g.priceInfo.tenderPrice,
  702. },
  703. {
  704. name: "NormPrice",
  705. value: g.priceInfo.basePrice,
  706. },
  707. {
  708. name: "IsAdd",
  709. value: g.unit_price.is_add,
  710. },
  711. ];
  712. Element.call(this, "Mech", attrs);
  713. let FixedCostItems = [];
  714. let fcsum = 0;
  715. let VariableCostItems = [];
  716. let vcsum = 0;
  717. if (g.ratio_data && g.ratio_data.length > 0) {
  718. for (let ratio of g.ratio_data) {
  719. let rIndex = gljUtil.getIndex(ratio);
  720. let rglj = gljKeyMap[rIndex];
  721. let ts = scMathUtil.roundForObj(parseFloat(ratio.consumption) * rglj.priceInfo.tenderPrice, decimalObj.glj.unitPrice);
  722. if (FixedCostMap[ratio.name]) {
  723. FixedCostItems.push(new FixedCostItem(ratio));
  724. fcsum = scMathUtil.roundForObj(fcsum + ts, decimalObj.glj.unitPrice);
  725. } else {
  726. VariableCostItems.push(new VariableCostItem(ratio));
  727. vcsum = scMathUtil.roundForObj(vcsum + ts, decimalObj.glj.unitPrice);
  728. }
  729. }
  730. }
  731. if (FixedCostItems.length > 0) {
  732. let fc = new FixedCost(fcsum);
  733. fc.children = FixedCostItems;
  734. this.children.push(fc);
  735. }
  736. if (VariableCostItems.length > 0) {
  737. let vc = new VariableCost(vcsum);
  738. vc.children = VariableCostItems;
  739. this.children.push(vc);
  740. }
  741. function VariableCost(sum) {
  742. const attrs = [{
  743. name: "VariableCostSum",
  744. value: sum,
  745. }];
  746. Element.call(this, "VariableCost", attrs);
  747. }
  748. function VariableCostItem(item) {
  749. const attrs = [{
  750. name: "VariableCostNo",
  751. value: item.code,
  752. },{
  753. name: "Consumption",
  754. value: item.consumption,
  755. }]
  756. Element.call(this, "VariableCostItem", attrs);
  757. }
  758. function FixedCost(sum) {
  759. const attrs = [{
  760. name: "FixedCostSum",
  761. value: sum,
  762. }, {
  763. name: "FixedRate",
  764. value: 1,
  765. }];
  766. Element.call(this, "FixedCost", attrs);
  767. }
  768. function FixedCostItem(item) {
  769. const attrs = [{
  770. name: "FixedCostNo",
  771. value: ratioCodeMap[item.code],
  772. },{
  773. name: "Sum",
  774. value: item.consumption,
  775. }]
  776. Element.call(this, "FixedCostItem", attrs);
  777. }
  778. }
  779. let Mps = new emptyElement("Mps");
  780. let Materials = new emptyElement("Materials");
  781. let Mechs = new emptyElement("Mechs");
  782. let gljKeyMap = {};
  783. let temMechs = [];
  784. if (isBidSubmission || isControl) { //导出到招标文件中,不输出这一部分。
  785. for (let g of pgljData.gljList) {
  786. if (!g.quantity) {
  787. continue;
  788. }
  789. let type = g.type + "";
  790. gljKeyMap[gljUtil.getIndex(g)] = g;
  791. type = type.charAt(0);
  792. if (type == "1") {
  793. Mps.children.push(new Mp(g));
  794. } else if (type == "2" || type == 5) {
  795. Materials.children.push(new Material(g));
  796. } else if (type == "3") {
  797. temMechs.push(g);
  798. }
  799. }
  800. for (let t of temMechs) {
  801. Mechs.children.push(new Mech(t,gljKeyMap));
  802. }
  803. }
  804. this.children.push(Mps);
  805. this.children.push(Materials);
  806. this.children.push(Mechs);
  807. }
  808. function EprjInfo(tenderProject) {
  809. let bills = tenderProject.Bills.datas;
  810. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  811. let totalItem = null;
  812. let proItem = null; //暂列金额项
  813. let safeItem = null;
  814. let oneToSevenItem = null;
  815. for (let b of bills) {
  816. if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.TOTAL_COST) totalItem = b;
  817. if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.PROVISIONAL) proItem = b;
  818. if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.ONE_SEVEN_BILLS) oneToSevenItem = b;
  819. if(b.code == "102-3" && b.name=="安全生产费") safeItem = b;
  820. }
  821. const attrs = [{
  822. name: "Name",
  823. value: tenderProject.projectInfo.name,
  824. },
  825. {
  826. name: "Sums",
  827. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  828. },
  829. ];
  830. //输出控制价、投标文件时,取调价后的标段总造价。
  831. //输出招标文件时,取0
  832. if (isBidInvitation) attrs[1].value = 0;
  833. Element.call(this, "EprjInfo", attrs);
  834. this.children.push(new SummaryOfCost(totalItem, proItem,safeItem,oneToSevenItem,feature));
  835. this.children.push(new MakeInfo(tenderProject));
  836. this.children.push(new Params(tenderProject));
  837. this.children.push(new getBillsItems(tenderProject));
  838. this.children.push(new getIndexs(tenderProject));
  839. let bidEvaluationMainMaterials = getBidEvaluationMainMaterial(tenderProject);
  840. if(bidEvaluationMainMaterials.length > 0) this.children.push(...bidEvaluationMainMaterials);
  841. }
  842. function getBidEvaluationMainMaterial(tenderProject) {
  843. let bidMaterials = [];
  844. let i = 1;
  845. for (let b of tenderProject.bidMaterialData) {
  846. bidMaterials.push(new BidEvaluationMainMaterial(b, i));
  847. i++
  848. }
  849. return bidMaterials;
  850. function BidEvaluationMainMaterial(b, index) {
  851. const attrs = [{
  852. name: "Code",
  853. value: b.seq,
  854. },
  855. {
  856. name: "Number",
  857. value: b.code
  858. },
  859. {
  860. name: "Name",
  861. value: b.name
  862. },
  863. {
  864. name: "Specification",
  865. value: b.specs
  866. },
  867. {
  868. name: "Unit",
  869. value: b.unit
  870. },
  871. {
  872. name: "Price",
  873. value: b.marketPrice || '0',
  874. type: TYPE.DECIMAL
  875. },
  876. {
  877. name: "LimitedPrice",
  878. value: b.marketPrice || '0',
  879. type: TYPE.DECIMAL
  880. },
  881. {
  882. name: "Quantity",
  883. value: 0,//b.quantity
  884. type: TYPE.DECIMAL
  885. },
  886. {
  887. name: "Total",
  888. value: 0//b.totalPrice
  889. },
  890. {
  891. name: "Remark",
  892. value: b.remark
  893. }
  894. ];
  895. if (isBidSubmission || isControl) {
  896. attrs[7].value = b.quantity;
  897. attrs[8].value = b.totalPrice;
  898. }
  899. Element.call(this, "BidEvaluationMainMaterial", attrs);
  900. }
  901. }
  902. function getIndexs(tenderProject) {
  903. let Indexs = new emptyElement('Indexs');
  904. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  905. for (let f of feature) {
  906. if (f.code) Indexs.children.push(new IndexItem(f))
  907. }
  908. return Indexs;
  909. function IndexItem(fea) {
  910. const attrs = [{
  911. name: "Code",
  912. value: fea.code,
  913. },
  914. {
  915. name: "Name",
  916. value: fea.dispName,
  917. },
  918. {
  919. name: "Unit",
  920. value: fea.unit,
  921. },
  922. {
  923. name: "Value",
  924. value: fea.value,
  925. },
  926. {
  927. name: "Remark",
  928. value: fea.remark,
  929. }
  930. ]
  931. Element.call(this, "IndexItem", attrs);
  932. }
  933. }
  934. function getBillsItems(tenderProject) {
  935. let items = new emptyElement("Items");
  936. let rootNodes = tenderProject.mainTree.roots;
  937. for (let r of rootNodes) {
  938. setItem(r, -1, items.children);
  939. }
  940. return items;
  941. function setItem(bNode, level, list) {
  942. if (bNode.sourceType == ModuleNames.ration) return;
  943. let item = new bill(bNode, level);
  944. if (bNode.children && bNode.children.length > 0) {
  945. level += 1;
  946. for (let c of bNode.children) {
  947. setItem(c, level, item.children);
  948. }
  949. }
  950. list.push(item);
  951. function getCalcType(node) {
  952. /*
  953. 判断是否父项:
  954. 是父项,则取1;
  955. 是叶子项,则判断其下有无套定额/量价/工料机:
  956. 有则取1;
  957. 无则判断有无基数计算:
  958. 有则取2;
  959. 无则取3 */
  960. if (node.children && node.children.length > 0) {
  961. return 1; //是父项,则取1, 有套定额/量价/工料机,也取1
  962. } else {
  963. return node.data.calcBase && node.data.calcBase != "" ? 2 : 3
  964. }
  965. }
  966. function getItemType(node) {
  967. let Bills = projectObj.project.Bills;
  968. //是100~900章部分、或是计日工部分,叶子清单输出1,父项输出0;
  969. if (Bills.isBelongOneToSeven(node)||Bills.isBelongDayWork(node)) {
  970. if (node.children && node.children.length > 0) {
  971. return node.children[0].sourceType == ModuleNames.ration ? 1 : 0
  972. }
  973. return 1 //叶子清单输出1
  974. } else {
  975. return 0;
  976. /* //非100~900章部分,
  977. // 是暂列金额,判断暂列金额的金额等于0,则输出为0;暂列金额的金额不等于0,则输出为1;
  978. if (node.data.name && node.data.name.indexOf("暂列金额") != -1) {
  979. let sum = node.data.feesIndex && node.data.feesIndex.common ? node.data.feesIndex.common.tenderTotalFee : "";
  980. return gljUtil.isNotEmpty(sum) ? 1 : 0
  981. } else { //非暂列金额,则判断清单的工程量是否等于0,等于0,则输出0;不等于0,则输出1
  982. return gljUtil.isNotEmpty(node.data.quantity) ? 1 : 0
  983. } */
  984. }
  985. }
  986. function bill(bNode, level) {
  987. let data = bNode.data;
  988. let CostKind = 3;
  989. if (data.name && data.name.indexOf("安全生产费") != -1) CostKind = 1;
  990. if (data.name && data.name.indexOf("暂列金额") != -1) CostKind = 2;
  991. //1 = 工程量×综合单价;2 = 计算基数×费率;3 = 工程量×单价。
  992. let CalcType = getCalcType(bNode);
  993. //取暂估价类型。读取造价书界面的专项暂定列。0=材料暂估价,1=工程设备暂估价,2=专业工程暂估价,没有选的输出为空。
  994. let ProvisionalType = "";
  995. if (data.specialProvisional == "材料") ProvisionalType = 0;
  996. if (data.specialProvisional == "工程设备") ProvisionalType = 1;
  997. if (data.specialProvisional == "专业工程") ProvisionalType = 2;
  998. //MpRatio
  999. let MpRatio = "";
  1000. let MaterialRatio = "";
  1001. let MechRatio = "";
  1002. if (data.quantityCoe) {
  1003. if (data.quantityCoe["labour"]) MpRatio = data.quantityCoe["labour"];
  1004. if (data.quantityCoe["material"]) MaterialRatio = data.quantityCoe["material"];
  1005. if (data.quantityCoe["machine"]) MechRatio = data.quantityCoe["machine"];
  1006. }
  1007. let fail = billNameChecking(bNode,tenderProject.projectInfo.name,fixedFlag)
  1008. //fail: { hint: '错误提示', type: '提示所属(基本就是单位工程名称)' }
  1009. let ListCode = "";
  1010. if (ListCodeMap[data.name]) ListCode = ListCodeMap[data.name];
  1011. if (data.code && data.code != "") ListCode = data.code;
  1012. const attrs = [{
  1013. name: "ListCode",
  1014. value: ListCode,
  1015. },
  1016. {
  1017. name: "ListName",
  1018. value: data.name,
  1019. fail:fail
  1020. },
  1021. {
  1022. name: "Unit",
  1023. value: data.unit,
  1024. },
  1025. {
  1026. name: "Num",
  1027. value: data.quantity,
  1028. type: TYPE.DECIMAL,
  1029. toFix:3
  1030. },
  1031. {
  1032. name: "QtyFormula",
  1033. value: data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",//data.calcBase //data.calcBase ? cbParser.toFExpr(data.calcBase, tenderProject.mainTree.items) : "",
  1034. type: TYPE.DECIMAL,
  1035. toFix:2
  1036. },
  1037. {
  1038. name: "Price",
  1039. value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "",
  1040. type: TYPE.DECIMAL,
  1041. toFix:2
  1042. },
  1043. {
  1044. name: "Rate",
  1045. value: 100,
  1046. },
  1047. {
  1048. name: "Sum",
  1049. value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",
  1050. type: TYPE.DECIMAL,
  1051. toFix:2
  1052. },
  1053. {
  1054. name: "ChapterKind",
  1055. value: level > 3 ? 3 : level,
  1056. },
  1057. {
  1058. name: "CostKind",
  1059. value: CostKind,
  1060. },
  1061. {
  1062. name: "CalcType",
  1063. value: CalcType,
  1064. },
  1065. {
  1066. name: "ProvisionalType",
  1067. value: ProvisionalType,
  1068. mustHasValue:true
  1069. },
  1070. {
  1071. name: "MeterRules",
  1072. value: "",
  1073. },
  1074. {
  1075. name: "Content",
  1076. value: data.jobContentText,
  1077. },
  1078. {
  1079. name: "Remarks",
  1080. value: data.remark,
  1081. },
  1082. /* {
  1083. name: "MpRatio",
  1084. value: MpRatio,
  1085. },
  1086. {
  1087. name: "MaterialRatio",
  1088. value: MaterialRatio,
  1089. },
  1090. {
  1091. name: "MechRatio",
  1092. value: MechRatio,
  1093. },
  1094. {
  1095. name: "AdjustedPrice",
  1096. value: data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "",
  1097. },
  1098. {
  1099. name: "AdjustedSums",
  1100. value: data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",
  1101. }, */
  1102. {
  1103. name: "ItemType",
  1104. value: getItemType(bNode),
  1105. },
  1106. /* {
  1107. name: "FomulaCode",
  1108. value: ""
  1109. }, */
  1110. ];
  1111. //投标、招标控制价时。取单价。
  1112. //招标时,如果是“安全生产费”或“暂列金额”,取单价,否则取0。
  1113. if (isBidSubmission || isControl || CostKind==1 ||CostKind==2) {
  1114. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "";
  1115. attrs[7].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1116. //暂列金额 数量为0的时候,单价输出0
  1117. if( CostKind==2 && !gljUtil.isNotEmpty(data.quantity)) attrs[5].value = 0
  1118. }
  1119. Element.call(this, "Item", attrs);
  1120. let cc = CostComposition(bNode);
  1121. if (cc) this.children.push(cc);
  1122. this.children.push(CostStructure(data))
  1123. function CostComposition(bNode) {
  1124. if (isBidInvitation) return null;
  1125. let CostComposition = new emptyElement('CostComposition');
  1126. let Norms = [];
  1127. let Costs = [];
  1128. if (bNode.children && bNode.children.length > 0 && bNode.children[0].sourceType == ModuleNames.ration) {
  1129. for (let r of bNode.children) {
  1130. if (r.data.type == rationType.ration) {
  1131. if(isEmptyRation(r.data)) continue;//定额空行不输出到接口文件中。
  1132. Norms.push(new Ration(r.data));
  1133. } else {
  1134. Costs.push(new Cost(r.data));
  1135. }
  1136. }
  1137. }
  1138. if (Norms.length > 0) CostComposition.children.push(...Norms);
  1139. if (Costs.length > 0) CostComposition.children.push(...Costs);
  1140. if (bNode.data.calcBase) CostComposition.children.push(new Formula(bNode.data));
  1141. return CostComposition.children.length > 0 ? CostComposition : null;
  1142. //定额空行不输出到接口文件中。 //定额空行的判断是:定额编码、定额名称、定额单位、定额单位、定额工程量为零或为空时
  1143. function isEmptyRation(ration){
  1144. return !gljUtil.isNotEmpty(ration.code)&&!gljUtil.isNotEmpty(ration.name)&&!gljUtil.isNotEmpty(ration.unit)&&(!gljUtil.isNotEmpty(ration.quantity)||ration.quantity == 0)
  1145. }
  1146. function Formula(bills) {
  1147. const attrs = [{
  1148. name: "Name",
  1149. value: bills.name
  1150. },
  1151. {
  1152. name: "Formulas",
  1153. value: bills.calcBase
  1154. },
  1155. {
  1156. name: "Ratio",
  1157. value: 1
  1158. },
  1159. {
  1160. name: "Sum",
  1161. value: bills.feesIndex && bills.feesIndex.common ? bills.feesIndex.common.tenderTotalFee : "",
  1162. type:TYPE.DECIMAL
  1163. },
  1164. {
  1165. name: "Remarks",
  1166. value: bills.remark
  1167. }
  1168. ]
  1169. Element.call(this, "Formula", attrs);
  1170. // 1.Name
  1171. // 名称/描述。取清单的名称。
  1172. // 2.Formulas
  1173. // 计算式。读取计算基数的文本。
  1174. // 取基数计算窗口内容,基数直接转换为金额?参考标准文档的 7.11 及 7.12 节。
  1175. // 7.11是定额的费用,7.12是清单累进基数,主要是估概预算中用到,清单里的不同,所以中山的接口直接输出基数文本。
  1176. // 3.Ratio
  1177. // 系数。输出为1,非必填。
  1178. // 4.Sum
  1179. // 取金额。
  1180. // 5.Remarks
  1181. }
  1182. function Cost(item) {
  1183. let BasePrice = 0;
  1184. if (item.type == rationType.volumePrice) { // 当插入的是量价时,基价读取单价列。
  1185. BasePrice = item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
  1186. } else {
  1187. BasePrice = getBasePrice(item.projectGLJID, tenderProject)
  1188. }
  1189. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  1190. let CostTypeNo = '';
  1191. if (feeRateMap[calcMap[item.programID]]) CostTypeNo = feeRateMap[calcMap[item.programID]];
  1192. const attrs = [{
  1193. name: "Code",
  1194. value: item.code,
  1195. }, {
  1196. name: 'Name',
  1197. value: item.name
  1198. }, {
  1199. name: 'Spec',
  1200. value: item.specs
  1201. }, {
  1202. name: 'Unit',
  1203. value: item.unit
  1204. }, {
  1205. name: 'Num',
  1206. value: item.tenderQuantity
  1207. }, {
  1208. name: 'BasePrice',
  1209. value: BasePrice
  1210. }, {
  1211. name: 'Price',
  1212. value: item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
  1213. }, {
  1214. name: 'IsEquipment',
  1215. value: item.subType == gljType.EQUIPMENT ? 1 : 0
  1216. }, {
  1217. name: 'CostTypeNo',
  1218. value: CostTypeNo
  1219. }, {
  1220. name: 'ProfitRate',
  1221. value: getFeeRate(item.programID, 'profit', tenderProject)
  1222. },
  1223. {
  1224. name: 'TaxRate',
  1225. value: getFeeRate(item.programID, 'tax', tenderProject)
  1226. },
  1227. {
  1228. name: 'MpRatio',
  1229. value: item.subType == gljType.LABOUR ? 100 : 0
  1230. },
  1231. {
  1232. name: 'MaterialRatio',
  1233. value: item.subType == gljType.GENERAL_MATERIAL ? 100 : 0
  1234. },
  1235. {
  1236. name: 'MechRatio',
  1237. value: item.subType == gljType.GENERAL_MACHINE ? 100 : 0
  1238. }
  1239. ]
  1240. Element.call(this, "Cost", attrs);
  1241. this.children.push(CostStructure(item));
  1242. }
  1243. function Ration(ration) {
  1244. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  1245. let CostTypeNo = '';
  1246. if (feeRateMap[calcMap[ration.programID]]) CostTypeNo = feeRateMap[calcMap[ration.programID]];
  1247. const attrs = [{
  1248. name: "NormLibNo",
  1249. value: 'YSDE-000000-2018-86',
  1250. }, {
  1251. name: 'DisplayCode',
  1252. value: ration.code
  1253. }, {
  1254. name: 'Name',
  1255. value: ration.name
  1256. }, {
  1257. name: 'Unit',
  1258. value: ration.unit
  1259. }, {
  1260. name: 'Num',
  1261. value: ration.tenderQuantity
  1262. },
  1263. {
  1264. name: 'CostTypeNo',
  1265. value: CostTypeNo
  1266. },
  1267. {
  1268. name: 'ProfitRate',
  1269. value: getFeeRate(ration.programID, 'profit', tenderProject) //tenderProject.ProfitRate
  1270. },
  1271. {
  1272. name: 'TaxRate',
  1273. value: getFeeRate(ration.programID, 'tax', tenderProject) //tenderProject.TaxRate
  1274. },
  1275. {
  1276. name: 'FabricationCost',
  1277. value: ration.feesIndex && ration.feesIndex.common ? ration.feesIndex.common.tenderTotalFee : 0
  1278. },
  1279. {
  1280. name: 'AdjustStatus',
  1281. value: ration.adjustState
  1282. }
  1283. ]
  1284. Element.call(this, "Norm", attrs);
  1285. this.children.push(CostStructure(ration));
  1286. this.children.push(Consume(ration));
  1287. }
  1288. }
  1289. function Consume(ration) {
  1290. let consume = new emptyElement('Consume');
  1291. for (let rg of ration.rationGLJList) {
  1292. consume.children.push(new ConsumeItem(rg));
  1293. }
  1294. return consume;
  1295. function ConsumeItem(rg) {
  1296. const attrs = [{
  1297. name: "Code",
  1298. value: rg.code,
  1299. }, {
  1300. name: "Consumption",
  1301. value: rg.tenderQuantity
  1302. }];
  1303. Element.call(this, "ConsumeItem", attrs);
  1304. }
  1305. }
  1306. function CostStructure(item) {
  1307. let CostStructure = new emptyElement('CostStructure');
  1308. for (let f of cpFeeTypes) {
  1309. if(itemFeeMap[f.type]) CostStructure.children.push(new CostItem(item,f.type))
  1310. }
  1311. if (CostStructure.children.length == 0) CostStructure.children.push(new CostItem({},""))
  1312. function CostItem(item,type) {
  1313. const attrs = [{
  1314. name: "ItemNo",
  1315. value: itemFeeMap[type],
  1316. }, {
  1317. name: 'Sum',
  1318. value: 0 //fee.tenderTotalFee
  1319. }]
  1320. if ((isBidSubmission || isControl) && item.feesIndex && item.feesIndex[type]) attrs[1].value = item.feesIndex[type].tenderTotalFee;
  1321. Element.call(this, "CostItem", attrs);
  1322. }
  1323. return CostStructure;
  1324. }
  1325. }
  1326. }
  1327. }
  1328. function Params(tenderProject) {
  1329. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  1330. let featrueMap = {};
  1331. let baseMap = {};
  1332. for (let f of feature) {
  1333. featrueMap[f.key] = f;
  1334. }
  1335. let baseInfo = _.find(tenderProject.property.basicInformation, {
  1336. dispName: "基本信息",
  1337. });
  1338. for (let i of baseInfo.items) {
  1339. let key = i.key;
  1340. //if (i.dispName == "编制日期") key = "编制时间";
  1341. baseMap[key] = i;
  1342. }
  1343. let BuildType = "";
  1344. if (baseMap["natureConstruction"].value == "新建") BuildType = 0;
  1345. if (baseMap["natureConstruction"].value == "改扩建") BuildType = 1;
  1346. let Terrain = "";
  1347. if (baseMap["terrainCategory"].value == "平原微丘") Terrain = 0;
  1348. if (baseMap["terrainCategory"].value == "山岭重丘") Terrain = 1;
  1349. let DesignSpeed = featrueMap["designSpeed"].value;
  1350. let Structure = "";
  1351. if (featrueMap["pavementStructure"].value == "沥青路面") Structure = 0;
  1352. if (featrueMap["pavementStructure"].value == "水泥混凝土路面") Structure = 1;
  1353. if (featrueMap["pavementStructure"].value == "其他类型路面") Structure = 2;
  1354. let RoadGrade = "";
  1355. if (RoadGradeMap[baseMap["roadGrade"].value]) RoadGrade = RoadGradeMap[baseMap["roadGrade"].value];
  1356. const attrs = [{
  1357. name: "PrjArea",
  1358. value: baseMap["location"] ? baseMap["location"].value : ""
  1359. },
  1360. {
  1361. name: "StartPileNo",
  1362. value: baseMap["startChainages"] ? baseMap["startChainages"].value : "",
  1363. mustHasValue: true
  1364. },
  1365. {
  1366. name: "EndPileNo",
  1367. value: baseMap["endChainages"] ? baseMap["endChainages"].value : "",
  1368. mustHasValue: true
  1369. },
  1370. {
  1371. name: "BuildType",
  1372. value: BuildType,
  1373. },
  1374. {
  1375. name: "Terrain",
  1376. value: Terrain,
  1377. mustHasValue: true
  1378. },
  1379. {
  1380. name: "RoadGrade",
  1381. value: RoadGrade,
  1382. mustHasValue: true
  1383. },
  1384. {
  1385. name: "DesignSpeed",
  1386. value: DesignSpeed,
  1387. mustHasValue: true
  1388. },
  1389. {
  1390. name: "Structure",
  1391. value: Structure,
  1392. mustHasValue: true
  1393. },
  1394. {
  1395. name: "SubgradeWidth",
  1396. value: featrueMap["subgradeWidth"] ? featrueMap["subgradeWidth"].value : "",
  1397. mustHasValue: true
  1398. },
  1399. {
  1400. name: "RoadLength",
  1401. value: featrueMap["roadLength"] ? featrueMap["roadLength"].value : "",
  1402. mustHasValue: true
  1403. },
  1404. {
  1405. name: "BridgeLength",
  1406. value: featrueMap["bridgeLength"] ? featrueMap["bridgeLength"].value : "",
  1407. mustHasValue: true
  1408. },
  1409. {
  1410. name: "TunnelLength",
  1411. value: featrueMap["tunnelLength"] ? featrueMap["tunnelLength"].value : "",
  1412. mustHasValue: true
  1413. },
  1414. {
  1415. name: "BriTunRate",
  1416. value: featrueMap["briTunRate"] ? featrueMap["briTunRate"].value : "",
  1417. mustHasValue: true
  1418. },
  1419. {
  1420. name: "InterchangeNum",
  1421. value: featrueMap["interchangeNum"] ? featrueMap["interchangeNum"].value : "",
  1422. mustHasValue: true
  1423. },
  1424. {
  1425. name: "StubLengths",
  1426. value: featrueMap["stubLengths"] ? featrueMap["stubLengths"].value : "",
  1427. mustHasValue: true
  1428. },
  1429. {
  1430. name: "LaneLength",
  1431. value: featrueMap["laneLength"] ? featrueMap["laneLength"].value : "",
  1432. mustHasValue: true
  1433. },
  1434. ];
  1435. Element.call(this, "Params", attrs);
  1436. }
  1437. function SummaryOfCost(totalItem, proItem,safeItem,oneToSevenItem,feature) {
  1438. let attrs = [{
  1439. name: "TenderSumLimit",
  1440. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1441. type: TYPE.DECIMAL,
  1442. toFix:2,
  1443. },
  1444. {
  1445. name: "BidTotal",
  1446. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1447. type: TYPE.DECIMAL,
  1448. toFix:2,
  1449. },
  1450. {
  1451. name: "BillTotal",
  1452. value: oneToSevenItem.feesIndex && oneToSevenItem.feesIndex.common && oneToSevenItem.feesIndex.common.tenderTotalFee ? oneToSevenItem.feesIndex.common.tenderTotalFee : 0,
  1453. type: TYPE.DECIMAL,
  1454. toFix:2,
  1455. },
  1456. {
  1457. name: "CostForHSE",
  1458. value: safeItem && safeItem.feesIndex && safeItem.feesIndex.common && safeItem.feesIndex.common.tenderTotalFee ? safeItem.feesIndex.common.tenderTotalFee : 0,
  1459. type: TYPE.DECIMAL,
  1460. toFix:2,
  1461. },
  1462. {
  1463. name: "ProvisionalSums",
  1464. value: proItem.feesIndex && proItem.feesIndex.common && proItem.feesIndex.common.tenderTotalFee ? proItem.feesIndex.common.tenderTotalFee : 0,
  1465. type: TYPE.DECIMAL,
  1466. toFix:2,
  1467. },
  1468. {
  1469. name: "Appraisal",
  1470. value: totalItem.feesIndex && totalItem.feesIndex.estimate && totalItem.feesIndex.estimate.tenderTotalFee ? totalItem.feesIndex.estimate.tenderTotalFee : 0,
  1471. type: TYPE.DECIMAL,
  1472. toFix:2,
  1473. },
  1474. ];
  1475. if (isBidInvitation) {
  1476. attrs.splice(0, 3) //招标
  1477. }
  1478. //if (isControl) attrs.splice(1, 5); //控制价
  1479. if (isBidSubmission) { //投标文件时,读工程特征中的 招标控制价 值
  1480. let tenderSumLimit = _.find(feature, { "key": "tenderSumLimit" });
  1481. if(tenderSumLimit) attrs[0].value = tenderSumLimit.value
  1482. }
  1483. Element.call(this, "SummaryOfCost", attrs);
  1484. }
  1485. function MakeInfo(tenderProject) {
  1486. let property = tenderProject.property;
  1487. let baseMap = {};
  1488. let baseInfo = _.find(property.basicInformation, {
  1489. dispName: "基本信息",
  1490. });
  1491. for (let i of baseInfo.items) {
  1492. let key = i.key;
  1493. //if (i.dispName == "编制日期") key = "编制时间";
  1494. baseMap[key] = i;
  1495. }
  1496. //mustHasValue
  1497. const attrs = [{
  1498. name: "ValuationModel",
  1499. value: property.taxType,
  1500. },
  1501. {
  1502. name: "Manage",
  1503. value: baseMap["constructingUnit"] ? baseMap["constructingUnit"].value : "",
  1504. },
  1505. {
  1506. name: "Designer",
  1507. value: baseMap["designUnit"] ? baseMap["designUnit"].value : "",
  1508. mustHasValue:true
  1509. },
  1510. {
  1511. name: "Compile",
  1512. value: baseMap["compileUnit"] ? baseMap["compileUnit"].value : "",
  1513. },
  1514. {
  1515. name: "CompileApprover",
  1516. value: baseMap["compileApprover"] ? baseMap["compileApprover"].value : "",
  1517. },
  1518. {
  1519. name: "CompileCertNo",
  1520. value: baseMap["compileCertNo"] ? baseMap["compileCertNo"].value : "",
  1521. mustHasValue:true
  1522. },
  1523. {
  1524. name: "CompileDate",
  1525. value: baseMap["compileDate"] && baseMap["compileDate"].value != "" ? baseMap["compileDate"].value + "T00:00:00" : "",
  1526. mustHasValue:true
  1527. },
  1528. {
  1529. name: "Review",
  1530. value: baseMap["reviewUnit"] ? baseMap["reviewUnit"].value : "",
  1531. mustHasValue:true
  1532. },
  1533. {
  1534. name: "ReviewApprover",
  1535. value: baseMap["reviewApprover"] ? baseMap["reviewApprover"].value : "",
  1536. mustHasValue:true
  1537. },
  1538. {
  1539. name: "ReviewCertNo",
  1540. value: baseMap["reviewCertNo"] ? baseMap["reviewCertNo"].value : "",
  1541. mustHasValue:true
  1542. },
  1543. {
  1544. name: "ReviewDate",
  1545. value: baseMap["reviewDate"] && baseMap["reviewDate"].value != "" ? baseMap["reviewDate"].value + "T00:00:00" : "",
  1546. mustHasValue:true
  1547. },
  1548. {
  1549. name: "Examine",
  1550. value: baseMap["examineUnit"] ? baseMap["examineUnit"].value : "",
  1551. mustHasValue:true
  1552. },
  1553. {
  1554. name: "ExamineApprover",
  1555. value: baseMap["examineApprover"] ? baseMap["examineApprover"].value : "",
  1556. mustHasValue:true
  1557. },
  1558. {
  1559. name: "ExamineCertNo",
  1560. value: baseMap["examineCertNo"] ? baseMap["examineCertNo"].value : "",
  1561. mustHasValue:true
  1562. },
  1563. {
  1564. name: "ExamineDate",
  1565. value: baseMap["examineDate"] && baseMap["examineDate"].value != "" ? baseMap["examineDate"].value + "T00:00:00" : "",
  1566. mustHasValue:true
  1567. },
  1568. {
  1569. name: "CompileExplain",
  1570. value: baseMap["compileExplain"] ? baseMap["compileExplain"].value : "",
  1571. mustHasValue:true
  1572. },
  1573. {
  1574. name: "ExamineExplain",
  1575. value: baseMap["examineExplain"] ? baseMap["examineExplain"].value : "",
  1576. mustHasValue:true
  1577. },
  1578. {
  1579. name: "ProjectExplain",
  1580. value: baseMap["projectExplain"] ? baseMap["projectExplain"].value : "",
  1581. mustHasValue:true
  1582. },
  1583. ];
  1584. if (isBidInvitation) { //招标文件,则以下的8、12~18则不输出
  1585. attrs.splice(11, 7);
  1586. attrs.splice(7, 1);
  1587. }
  1588. Element.call(this, "MakeInfo", attrs);
  1589. }
  1590. let data = new CprjInfo(projectData.name);
  1591. data.children.push(new SystemInfo(projectData));
  1592. data.children.push(new CostBasis());
  1593. let seriNo = 1;
  1594. let Rates = [];
  1595. let Practs = [];
  1596. let EprjInfos = [];
  1597. for (let c of projectData.children) {
  1598. let tenderProject = tenderDetailMap[c.ID];
  1599. let feeRataDatas = tenderProject.FeeRate.datas;
  1600. Rates.push(new Rate(tenderProject, feeRataDatas, seriNo));
  1601. Practs.push(new Pract(tenderProject, seriNo));
  1602. EprjInfos.push(new EprjInfo(tenderProject));
  1603. seriNo++;
  1604. }
  1605. data.children.push(...Rates,...Practs,...EprjInfos);
  1606. return [{
  1607. data: data,
  1608. exportKind: exportKind,
  1609. fileName: projectData.name + INTERFACE_CONFIG[areaKey]["fileSuffix"][exportKind],
  1610. }, ];
  1611. }
  1612. return {
  1613. entry,
  1614. };
  1615. })();