guangxi_common.js 61 KB

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