guangxi_common.js 61 KB

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